Merge remote-tracking branch 'origin/master'
已修改52个文件
已删除5个文件
已添加10个文件
| | |
| | | package com.iailab.module.data.api.plan; |
| | | |
| | | import com.iailab.module.data.api.plan.dto.ApiPlanDataDTO; |
| | | import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO; |
| | | import com.iailab.module.data.common.ApiDataQueryDTO; |
| | | import com.iailab.module.data.common.ApiDataValueDTO; |
| | | import com.iailab.module.data.enums.ApiConstants; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | |
| | | @PostMapping(PREFIX + "/query-plans/record-value") |
| | | @Operation(summary = "查询计划记录") |
| | | LinkedHashMap<String, List<ApiPlanDataDTO>> queryPlanItemRecordValue(@RequestBody ApiDataQueryDTO dto); |
| | | |
| | | @GetMapping(PREFIX + "/info/no/{itemNo}") |
| | | @Operation(summary = "根据测点编号查询测点信息") |
| | | ApiPlanItemDTO getInfoByNo(@PathVariable("itemNo") String itemNo); |
| | | } |
| | |
| | | package com.iailab.module.model.api.mcs; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.module.model.api.mcs.dto.*; |
| | | import com.iailab.module.model.enums.ApiConstants; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @FeignClient(name = ApiConstants.NAME) |
| | | @Tag(name = "RPC 服务 - 模型配置接口") |
| | | @Tag(name = "RPC 服务 - 模型配置信息接口") |
| | | public interface McsApi { |
| | | |
| | | String PREFIX = ApiConstants.PREFIX + "/mcs"; |
| | | |
| | | @GetMapping(PREFIX + "/predict-item-tree") |
| | | @GetMapping(PREFIX + "/predict-item/tree") |
| | | @Operation(summary = "预测项树") |
| | | CommonResult<List<PredictItemTreeDTO>> getPredictItemTree(); |
| | | List<PredictItemTreeDTO> getPredictItemTree(); |
| | | |
| | | @GetMapping(PREFIX + "/predict-item-info") |
| | | @Operation(summary = "预测项详情") |
| | | CommonResult<PredictItemInfoDTO> getPredictItemInfo(@RequestParam Map<String, Object> params); |
| | | @PostMapping(PREFIX + "/predict-data/charts") |
| | | PreDataBarLineRespVO getPreDataCharts(@RequestBody PreDataBarLineReqVO reqVO); |
| | | |
| | | @PostMapping(PREFIX + "/alarm-message/create") |
| | | @Operation(summary = "添加预警信息") |
| | | CommonResult<Boolean> createAlarmMessage(@RequestBody AlarmMessageRespDTO dto); |
| | | Boolean createAlarmMessage(@RequestBody AlarmMessageRespDTO dto); |
| | | |
| | | @GetMapping(PREFIX + "/alarm-message/list") |
| | | @Operation(summary = "获取预警信息列表") |
| | | CommonResult<AlarmMessageRespDTO> listAlarmMessage(@RequestParam Map<String, Object> params); |
| | | List<AlarmMessageRespDTO> listAlarmMessage(@RequestParam Map<String, Object> params); |
| | | |
| | | @PostMapping(PREFIX + "/schedule-suggest/create") |
| | | @Operation(summary = "添加调度建议") |
| | | CommonResult<Boolean> createScheduleSuggest(@RequestBody ScheduleSuggestRespDTO dto); |
| | | Boolean createScheduleSuggest(@RequestBody ScheduleSuggestRespDTO dto); |
| | | |
| | | @GetMapping(PREFIX + "/alarm-message/list") |
| | | @Operation(summary = "获取调度建议列表") |
| | | CommonResult<ScheduleSuggestRespDTO> listScheduleSuggest(@RequestParam ScheduleSuggestReqDTO params); |
| | | List<ScheduleSuggestRespDTO> listScheduleSuggest(@RequestParam ScheduleSuggestReqDTO params); |
| | | |
| | | @PostMapping(PREFIX + "/predict-model-setting/modify") |
| | | @Operation(summary = "修改预测模型设置参数") |
| | | CommonResult<Boolean> modifyPredictModelSetting(@RequestBody List<PredictModelSettingReqDTO> dtos); |
| | | Boolean modifyPredictModelSetting(@RequestBody List<PredictModelSettingReqDTO> dtos); |
| | | |
| | | @PostMapping(PREFIX + "/schedule-model-setting/modify") |
| | | @Operation(summary = "修改调度模型设置参数") |
| | | CommonResult<Boolean> modifyScheduleModelSetting(@RequestBody List<ScheduleModelSettingReqDTO> dtos); |
| | | Boolean modifyScheduleModelSetting(@RequestBody List<ScheduleModelSettingReqDTO> dtos); |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | private String itemId; |
| | | |
| | | @Schema(description = "预警时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date alarmTime; |
| | | |
| | | @Schema(description = "开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date startTime; |
| | | |
| | | @Schema(description = "结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date endTime; |
| | | } |
| | |
| | | * @createTime 2024年08月29日 |
| | | */ |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | private BigDecimal currentValue; |
| | | |
| | | @Schema(description = "超出时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date outTime; |
| | | |
| | | @Schema(description = "超出值") |
| | | private BigDecimal outValue; |
| | | |
| | | @Schema(description = "预警类型") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private String alarmType; |
| | | |
| | | @Schema(description = "预警时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date alarmTime; |
| | | |
| | | } |
对比新文件 |
| | |
| | | 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月13日 |
| | | */ |
| | | @Data |
| | | public class PreDataBarLineReqVO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "查询ID列表") |
| | | private List<String[]> queryIds; |
| | | |
| | | @Schema(description = "预测时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date predictTime; |
| | | |
| | | @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; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月13日 |
| | | */ |
| | | @Data |
| | | public class PreDataBarLineRespVO 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 = "开始时间") |
| | | @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; |
| | | |
| | | @Schema(description = "图例") |
| | | private List<String> legend; |
| | | |
| | | @Schema(description = "X轴数据") |
| | | private List<String> categories; |
| | | |
| | | @Schema(description = "图表数据") |
| | | private List<PreDataViewRespDTO> dataViewList; |
| | | } |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Schema(description = "RPC 模型 - 预测数据 DTO") |
| | | @Data |
| | | public class PreDataViewReqDTO { |
| | | public class PreDataViewReqDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "预测项ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private String itemId; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private String startTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private String endTime; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date predictTime; |
| | | } |
| | |
| | | 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.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | */ |
| | | @Schema(description = "RPC 模型 - 预测数据 DTO") |
| | | @Data |
| | | public class PreDataViewRespDTO { |
| | | public class PreDataViewRespDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "预测项ID") |
| | | private String itemId; |
| | |
| | | private String itemName; |
| | | |
| | | @Schema(description = "预测时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date predictTime; |
| | | |
| | | @Schema(description = "量程上限") |
| | |
| | | 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; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 预测项信息 |
| | | * |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年07月31日 |
| | |
| | | public class PredictItemInfoDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "预测项ID") |
| | | private String itemId; |
| | | |
| | | @Schema(description = "预测项编号") |
| | | private String itemNo; |
| | | |
| | | @Schema(description = "预测项名称") |
| | | private String itemName; |
| | | |
| | | @Schema(description = "预测项长度") |
| | | private BigDecimal predictLength; |
| | | } |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | public class PredictModelSettingReqDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "模型ID") |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 键 |
| | | */ |
| | | @Schema(description = "键") |
| | | private String key; |
| | | |
| | | /** |
| | | * 值 |
| | | */ |
| | | @Schema(description = "值") |
| | | private String value; |
| | | } |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | |
| | | public class ScheduleModelSettingReqDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "模型ID") |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 键 |
| | | */ |
| | | @Schema(description = "键") |
| | | private String key; |
| | | |
| | | /** |
| | | * 值 |
| | | */ |
| | | @Schema(description = "值") |
| | | private String value; |
| | | } |
| | |
| | | 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; |
| | | |
| | |
| | | private String adjustObj; |
| | | |
| | | @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; |
| | | |
| | |
| | | private BigDecimal adjustTimes; |
| | | |
| | | @Schema(description = "调整开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date adjustStart; |
| | | |
| | | @Schema(description = "调整结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date adjustEnd; |
| | | |
| | | @Schema(description = "建议时间") |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | @Data |
| | | public class MdkPredictDataDTO { |
| | | |
| | | @Schema(description = "数据时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date dataTime; |
| | | |
| | | @Schema(description = "数据值") |
| | | private Double dataValue; |
| | | } |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 单个预测项预测结果 |
| | | * |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | |
| | | @Data |
| | | public class MdkPredictItemRespDTO { |
| | | |
| | | @Schema(description = "预测时间") |
| | | private String itemId; |
| | | |
| | | @Schema(description = "预测时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date predictTime; |
| | | |
| | | private List<MdkPredictDataDTO> predictData; |
| | | @Schema(description = "单个预测项预测结果,KEY为预测项目编码") |
| | | private Map<String, List<MdkPredictDataDTO>> predictData; |
| | | } |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | @Data |
| | | public class MdkPredictModuleRespDTO { |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date predictTime; |
| | | |
| | | private String moduleType; |
| | | |
| | | @Schema(description = "模块预测结果,KEY为预测项目编码") |
| | | private Map<String, MdkPredictItemRespDTO> predictItemRespMap; |
| | | } |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @Schema(description = "预测时间") |
| | | @NotNull(message="预测时间不能为空") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date predictTime; |
| | | |
| | | @Schema(description = "预测模块(管网类型)") |
| | |
| | | |
| | | @Schema(description = "预测项编号") |
| | | private String itemNo; |
| | | |
| | | @Schema(description = "是否返回预测结果") |
| | | private Boolean isResult; |
| | | } |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | private String scheduleCode; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date scheduleTime; |
| | | |
| | | private Map<String, Object> result; |
| | |
| | | create table t_dm_module |
| | | ( |
| | | id varchar(36) not null, |
| | | modulename varchar(50), |
| | | moduletype varchar(30), |
| | | cycle decimal(5, 0), |
| | | modulenavconfig varchar(3072), |
| | | predicttime datetime, |
| | | collecttime datetime, |
| | | create_time datetime default current_timestamp, |
| | | update_time datetime default current_timestamp, |
| | | traintime datetime, |
| | | primary key (id), |
| | | UNIQUE INDEX uk_modulename (modulename), |
| | | INDEX idx_moduletype (moduletype) |
| | | id varchar(36) not null, |
| | | modulename varchar(50), |
| | | moduletype varchar(30), |
| | | cycle decimal(5, 0), |
| | | modulenavconfig varchar(3072), |
| | | predicttime datetime, |
| | | collecttime datetime, |
| | | create_time datetime default current_timestamp, |
| | | update_time datetime default current_timestamp, |
| | | traintime datetime, |
| | | primary key (id), |
| | | UNIQUE INDEX uk_modulename (modulename), |
| | | INDEX idx_moduletype (moduletype) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '管网表'; |
| | | |
| | | |
| | | create table t_dm_module_item |
| | | ( |
| | | id varchar(36) not null, |
| | | moduleid varchar(36), |
| | | itemid varchar(36), |
| | | itemorder bigint, |
| | | status bigint, |
| | | categoryid varchar(64), |
| | | primary key (id), |
| | | key idx_moduleid (moduleid) |
| | | id varchar(36) not null, |
| | | moduleid varchar(36), |
| | | itemid varchar(36), |
| | | itemorder bigint, |
| | | status bigint, |
| | | categoryid varchar(64), |
| | | primary key (id), |
| | | key idx_moduleid (moduleid) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '管网预测项关系表'; |
| | | |
| | | create table t_mm_item_output |
| | | ( |
| | | id varchar(36) not null, |
| | | itemid varchar(36), |
| | | pointid varchar(36), |
| | | resulttableid varchar(36), |
| | | tagname varchar(50), |
| | | outputorder decimal(5, 0), |
| | | primary key (id), |
| | | INDEX idx_itemid (itemid) |
| | | id varchar(36) not null, |
| | | itemid varchar(36), |
| | | pointid varchar(36), |
| | | resulttableid varchar(36), |
| | | tagname varchar(50), |
| | | outputorder decimal(5, 0), |
| | | primary key (id), |
| | | INDEX idx_itemid (itemid) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测项输出表'; |
| | | |
| | | create table t_mm_item_result |
| | | ( |
| | | id varchar(36) not null, |
| | | outputid varchar(36), |
| | | datatime datetime, |
| | | datavalue decimal(19, 3), |
| | | primary key (id), |
| | | INDEX idx_outputid (outputid), |
| | | INDEX idx_datatime (datatime) |
| | | id varchar(36) not null, |
| | | outputid varchar(36), |
| | | datatime datetime, |
| | | datavalue decimal(19, 3), |
| | | primary key (id), |
| | | INDEX idx_outputid (outputid), |
| | | INDEX idx_datatime (datatime) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '预测结果表'; |
| | | |
| | | create table t_mm_item_type |
| | | ( |
| | | id varchar(36) not null, |
| | | itemtypename varchar(50), |
| | | itemclasstype varchar(100), |
| | | assemblyname varchar(64), |
| | | primary key (id) |
| | | id varchar(36) not null, |
| | | itemtypename varchar(50), |
| | | itemclasstype varchar(100), |
| | | assemblyname varchar(64), |
| | | primary key (id) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测项类型表'; |
| | | |
| | | create table t_mm_model_arith_settings |
| | | ( |
| | | id varchar(36) not null, |
| | | modelid varchar(36), |
| | | `key` varchar(36), |
| | | value varchar(256), |
| | | name varchar(36), |
| | | valuetype varchar(36), |
| | | primary key (id), |
| | | INDEX idx_modelid (modelid) |
| | | id varchar(36) not null, |
| | | modelid varchar(36), |
| | | `key` varchar(36), |
| | | value varchar(256), |
| | | name varchar(36), |
| | | valuetype varchar(36), |
| | | primary key (id), |
| | | INDEX idx_modelid (modelid) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测模型设置参数表'; |
| | | |
| | | create table t_mm_model_param |
| | | ( |
| | | id varchar(36) not null, |
| | | modelid varchar(36), |
| | | modelparamname varchar(36), |
| | | modelparamid varchar(36), |
| | | modelparamorder integer, |
| | | modelparamportorder integer, |
| | | datalength integer, |
| | | modelparamtype varchar(36), |
| | | primary key (id), |
| | | INDEX idx_modelid (modelid) |
| | | id varchar(36) not null, |
| | | modelid varchar(36), |
| | | modelparamname varchar(36), |
| | | modelparamid varchar(36), |
| | | modelparamorder integer, |
| | | modelparamportorder integer, |
| | | datalength integer, |
| | | modelparamtype varchar(36), |
| | | primary key (id), |
| | | INDEX idx_modelid (modelid) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测模型输入参数表'; |
| | | |
| | | create table t_mm_model_resultstr |
| | | ( |
| | | id varchar(64) not null, |
| | | resultstr varchar(64), |
| | | primary key (id) |
| | | id varchar(64) not null, |
| | | resultstr varchar(64), |
| | | primary key (id) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测模型结果字符串表'; |
| | | |
| | | create table |
| | | t_mm_predict_item |
| | | t_mm_predict_item |
| | | ( |
| | | id varchar(36) not null, |
| | | itemno varchar(16), |
| | | itemname varchar(50), |
| | | caltypeid varchar(36), |
| | | itemtypeid varchar(36), |
| | | predictlength int, |
| | | granularity int, |
| | | status tinyint, |
| | | isfuse tinyint, |
| | | predictphase tinyint, |
| | | workchecked tinyint, |
| | | unittransfactor decimal(16, 6), |
| | | create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | saveindex varchar(16), |
| | | primary key (id), |
| | | UNIQUE INDEX uk_itemno (itemno), |
| | | INDEX uk_itemtypeid (itemtypeid) |
| | | id varchar(36) not null, |
| | | itemno varchar(16), |
| | | itemname varchar(50), |
| | | caltypeid varchar(36), |
| | | itemtypeid varchar(36), |
| | | predictlength int, |
| | | granularity int, |
| | | status tinyint, |
| | | isfuse tinyint, |
| | | predictphase tinyint, |
| | | workchecked tinyint, |
| | | unittransfactor decimal(16, 6), |
| | | create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | update_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | saveindex varchar(16), |
| | | primary key (id), |
| | | UNIQUE INDEX uk_itemno (itemno), |
| | | INDEX uk_itemtypeid (itemtypeid) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测项表'; |
| | | |
| | | create table |
| | | t_mm_predict_merge_item |
| | | t_mm_predict_merge_item |
| | | ( |
| | | id varchar(36) not null, |
| | | itemid varchar(36), |
| | | expression varchar(255), |
| | | num integer, |
| | | primary key (id), |
| | | UNIQUE INDEX uk_itemid (itemid) |
| | | id varchar(36) not null, |
| | | itemid varchar(36), |
| | | expression varchar(255), |
| | | num integer, |
| | | primary key (id), |
| | | UNIQUE INDEX uk_itemid (itemid) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '合并预测项表'; |
| | | |
| | | create table |
| | | t_mm_predict_model |
| | | t_mm_predict_model |
| | | ( |
| | | id varchar(36) not null, |
| | | modelno varchar(32), |
| | | modelname varchar(50), |
| | | itemid varchar(36), |
| | | arithid varchar(36), |
| | | trainsamplength decimal(5, 0), |
| | | predictsamplength decimal(5, 0), |
| | | isonlinetrain decimal(5, 0), |
| | | modelpath varchar(256), |
| | | isnormal decimal(5, 0), |
| | | normalmax decimal(19, 3), |
| | | normalmin decimal(19, 3), |
| | | status decimal(5, 0), |
| | | classname varchar(256), |
| | | methodname varchar(64), |
| | | modelparamstructure varchar(128), |
| | | resultstrid varchar(64), |
| | | settingmap varchar(256), |
| | | trainmodelpath varchar(256), |
| | | pathstatus decimal(5, 0), |
| | | pdim smallint, |
| | | traninip varchar(16), |
| | | comparisonclassname varchar(256), |
| | | primary key (id), |
| | | INDEX idx_modelno (modelno), |
| | | UNIQUE INDEX idx_itemid (itemid) |
| | | id varchar(36) not null, |
| | | modelno varchar(32), |
| | | modelname varchar(50), |
| | | itemid varchar(36), |
| | | arithid varchar(36), |
| | | trainsamplength decimal(5, 0), |
| | | predictsamplength decimal(5, 0), |
| | | isonlinetrain decimal(5, 0), |
| | | modelpath varchar(256), |
| | | isnormal decimal(5, 0), |
| | | normalmax decimal(19, 3), |
| | | normalmin decimal(19, 3), |
| | | status decimal(5, 0), |
| | | classname varchar(256), |
| | | methodname varchar(64), |
| | | modelparamstructure varchar(128), |
| | | resultstrid varchar(64), |
| | | settingmap varchar(256), |
| | | trainmodelpath varchar(256), |
| | | pathstatus decimal(5, 0), |
| | | pdim smallint, |
| | | traninip varchar(16), |
| | | comparisonclassname varchar(256), |
| | | primary key (id), |
| | | INDEX idx_modelno (modelno), |
| | | UNIQUE INDEX idx_itemid (itemid) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '预测项模型表'; |
| | | |
| | | create table t_mm_result_table |
| | | ( |
| | | id varchar(36) not null, |
| | | tablename varchar(30), |
| | | primary key (id) |
| | | id varchar(36) not null, |
| | | tablename varchar(30), |
| | | primary key (id) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测结果存放表'; |
| | | |
| | | |
| | | create table t_mm_item_result_json |
| | | ( |
| | | id varchar(36) not null, |
| | | outputid varchar(36), |
| | | predicttime datetime, |
| | | jsonvalue varchar(6400), |
| | | cumulant varchar(36), |
| | | primary key (id), |
| | | INDEX idx_outputid (outputid), |
| | | INDEX idx_predicttime (predicttime) |
| | | id varchar(36) not null, |
| | | outputid varchar(36), |
| | | predicttime datetime, |
| | | jsonvalue varchar(6400), |
| | | cumulant varchar(36), |
| | | primary key (id), |
| | | INDEX idx_outputid (outputid), |
| | | INDEX idx_predicttime (predicttime) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测JSON数据表'; |
| | | |
| | | create table |
| | | t_mm_item_result_last_point |
| | | t_mm_item_result_last_point |
| | | ( |
| | | id varchar(36) not null, |
| | | outputid varchar(36), |
| | | datatime datetime, |
| | | datavalue decimal(19, 3), |
| | | primary key (id), |
| | | INDEX idx_outputid (outputid), |
| | | INDEX idx_datatime (datatime) |
| | | id varchar(36) not null, |
| | | outputid varchar(36), |
| | | datatime datetime, |
| | | datavalue decimal(19, 3), |
| | | primary key (id), |
| | | INDEX idx_outputid (outputid), |
| | | INDEX idx_datatime (datatime) |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '预测T+L数据表'; |
| | | |
| | | create table t_mm_item_accuracy_rate |
| | | ( |
| | | id varchar(36) not null, |
| | | item_id varchar(36) not null COMMENT '预测项ID', |
| | | sample_length integer COMMENT '样本长度', |
| | | value_type integer COMMENT '值类型', |
| | | in_deviation decimal(8, 3) COMMENT '精准误差', |
| | | in_accuracy_rate decimal(6, 4) COMMENT '精准度', |
| | | out_deviation decimal(8, 3) COMMENT '不可信误差', |
| | | out_accuracy_rate decimal(6, 4) COMMENT '不可信率', |
| | | is_enable tinyint, |
| | | update_time datetime, |
| | | begin_time datetime, |
| | | primary key (id), |
| | | INDEX idx_item_id (item_id) |
| | | id varchar(36) not null, |
| | | item_id varchar(36) not null COMMENT '预测项ID', |
| | | sample_length integer COMMENT '样本长度', |
| | | value_type integer COMMENT '值类型', |
| | | in_deviation decimal(8, 3) COMMENT '精准误差', |
| | | in_accuracy_rate decimal(6, 4) COMMENT '精准度', |
| | | out_deviation decimal(8, 3) COMMENT '不可信误差', |
| | | out_accuracy_rate decimal(6, 4) COMMENT '不可信率', |
| | | is_enable tinyint, |
| | | update_time datetime, |
| | | begin_time datetime, |
| | | primary key (id), |
| | | INDEX idx_item_id (item_id) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '预测精准度表'; |
| | | |
| | | create table t_mm_predict_alarm_config |
| | | ( |
| | | id varchar(36) not null, |
| | | title varchar(20) COMMENT '消息标题', |
| | | alarm_obj varchar(36) COMMENT '监控对象', |
| | | item_id varchar(36) COMMENT '预测项ID', |
| | | comp_length int COMMENT '比较长度', |
| | | upper_limit decimal(10, 4) COMMENT '上限', |
| | | lower_limit decimal(10, 4) COMMENT '下限', |
| | | unit varchar(10) COMMENT '单位', |
| | | coefficient decimal(10, 4) COMMENT '转换系数', |
| | | model_id varchar(36) COMMENT '调度建议模型', |
| | | is_enable tinyint NOT NULL COMMENT '是否启用(0禁用 1启用)', |
| | | `creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | `updater` varchar(64) DEFAULT '' COMMENT '更新者', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | primary key (id) |
| | | id varchar(36) not null, |
| | | title varchar(20) COMMENT '消息标题', |
| | | alarm_obj varchar(36) COMMENT '监控对象', |
| | | item_id varchar(36) COMMENT '预测项ID', |
| | | comp_length int COMMENT '比较长度', |
| | | upper_limit decimal(10, 4) COMMENT '上限', |
| | | lower_limit decimal(10, 4) COMMENT '下限', |
| | | unit varchar(10) COMMENT '单位', |
| | | coefficient decimal(10, 4) COMMENT '转换系数', |
| | | model_id varchar(36) COMMENT '调度建议模型', |
| | | is_enable tinyint NOT NULL COMMENT '是否启用(0禁用 1启用)', |
| | | `creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | `updater` varchar(64) DEFAULT '' COMMENT '更新者', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | primary key (id) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '预警配置表'; |
| | | |
| | | create table t_mm_predict_alarm_message |
| | | ( |
| | | id varchar(36) not null, |
| | | title varchar(36) COMMENT '消息标题', |
| | | content varchar(128) COMMENT '消息内容', |
| | | alarm_obj varchar(36) COMMENT '监控对象', |
| | | point_id varchar(36) COMMENT '监控点位ID', |
| | | item_id varchar(36) COMMENT '预测项ID', |
| | | current_value decimal(18, 4) COMMENT '当前值', |
| | | out_time datetime COMMENT '超出时间', |
| | | out_value decimal(18, 4) COMMENT '超出值', |
| | | alarm_type varchar(10) COMMENT '预警类型', |
| | | alarm_time datetime COMMENT '预警时间', |
| | | create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | primary key (id), |
| | | INDEX idx_item_id (item_id), |
| | | INDEX idx_alarm_obj (alarm_obj), |
| | | INDEX idx_alarm_time (alarm_time) |
| | | id varchar(36) not null, |
| | | title varchar(36) COMMENT '消息标题', |
| | | content varchar(128) COMMENT '消息内容', |
| | | alarm_obj varchar(36) COMMENT '监控对象', |
| | | point_id varchar(36) COMMENT '监控点位ID', |
| | | item_id varchar(36) COMMENT '预测项ID', |
| | | current_value decimal(18, 4) COMMENT '当前值', |
| | | out_time datetime COMMENT '超出时间', |
| | | out_value decimal(18, 4) COMMENT '超出值', |
| | | alarm_type varchar(10) COMMENT '预警类型', |
| | | alarm_time datetime COMMENT '预警时间', |
| | | create_time datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | primary key (id), |
| | | INDEX idx_item_id (item_id), |
| | | INDEX idx_alarm_obj (alarm_obj), |
| | | INDEX idx_alarm_time (alarm_time) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '预警消息表'; |
| | | |
| | |
| | | |
| | | create table t_st_schedule_scheme |
| | | ( |
| | | `id` varchar(36) not null COMMENT 'ID', |
| | | `code` varchar(20) not null COMMENT '编号', |
| | | `name` varchar(20) not null COMMENT '名称', |
| | | `trigger_method` varchar(20) COMMENT '触发方式', |
| | | `trigger_condition` varchar(20) COMMENT '触发条件', |
| | | `schedule_obj` varchar(20) COMMENT '调整对象', |
| | | `schedule_type` varchar(20) COMMENT '调整类型', |
| | | `schedule_strategy` varchar(20) COMMENT '调整策略', |
| | | `model_id` varchar(36) COMMENT '调度模型', |
| | | `schedule_time` datetime COMMENT '调度时间', |
| | | `status` tinyint NOT NULL DEFAULT 0 COMMENT '方案状态(0正常 1停用)', |
| | | `remark` varchar(100) COMMENT '备注', |
| | | `creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | `updater` varchar(64) NULL DEFAULT '' COMMENT '更新者', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| | | primary key (id), |
| | | UNIQUE INDEX `uk_code` (`code` ASC) USING BTREE |
| | | `id` varchar(36) not null COMMENT 'ID', |
| | | `code` varchar(20) not null COMMENT '编号', |
| | | `name` varchar(20) not null COMMENT '名称', |
| | | `trigger_method` varchar(20) COMMENT '触发方式', |
| | | `trigger_condition` varchar(20) COMMENT '触发条件', |
| | | `schedule_obj` varchar(20) COMMENT '调整对象', |
| | | `schedule_type` varchar(20) COMMENT '调整类型', |
| | | `schedule_strategy` varchar(20) COMMENT '调整策略', |
| | | `model_id` varchar(36) COMMENT '调度模型', |
| | | `schedule_time` datetime COMMENT '调度时间', |
| | | `status` tinyint NOT NULL DEFAULT 0 COMMENT '方案状态(0正常 1停用)', |
| | | `remark` varchar(100) COMMENT '备注', |
| | | `creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | `updater` varchar(64) NULL DEFAULT '' COMMENT '更新者', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| | | primary key (id), |
| | | UNIQUE INDEX `uk_code` (`code` ASC) USING BTREE |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '调度方案表'; |
| | | |
| | | create table t_st_schedule_model |
| | | ( |
| | | `id` varchar(36) not null COMMENT 'ID', |
| | | `model_code` varchar(64) not null COMMENT '模型编号', |
| | | `model_name` varchar(64) not null COMMENT '模型名称', |
| | | `model_type` varchar(64) COMMENT '模型类型', |
| | | `class_name` varchar(128) COMMENT '类名', |
| | | `method_name` varchar(64) COMMENT '方法名', |
| | | `port_length` integer COMMENT '输入数量', |
| | | `param_structure` varchar(256) COMMENT '参数构造', |
| | | `model_path` varchar(256) COMMENT '路径', |
| | | `result_str_id` varchar(64) COMMENT '结果ID', |
| | | `invocation` varchar(64) COMMENT '调用方式', |
| | | `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0正常 1停用)', |
| | | `creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | `updater` varchar(64) NULL DEFAULT '' COMMENT '更新者', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| | | primary key (id), |
| | | UNIQUE INDEX `uk_model_code` (`model_code` ASC) USING BTREE |
| | | `id` varchar(36) not null COMMENT 'ID', |
| | | `model_code` varchar(64) not null COMMENT '模型编号', |
| | | `model_name` varchar(64) not null COMMENT '模型名称', |
| | | `model_type` varchar(64) COMMENT '模型类型', |
| | | `class_name` varchar(128) COMMENT '类名', |
| | | `method_name` varchar(64) COMMENT '方法名', |
| | | `port_length` integer COMMENT '输入数量', |
| | | `param_structure` varchar(256) COMMENT '参数构造', |
| | | `model_path` varchar(256) COMMENT '路径', |
| | | `result_str_id` varchar(64) COMMENT '结果ID', |
| | | `invocation` varchar(64) COMMENT '调用方式', |
| | | `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0正常 1停用)', |
| | | `creator` varchar(64) NOT NULL DEFAULT '' COMMENT '创建者', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | `updater` varchar(64) NULL DEFAULT '' COMMENT '更新者', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| | | primary key (id), |
| | | UNIQUE INDEX `uk_model_code` (`model_code` ASC) USING BTREE |
| | | ) engine = innodb default character set utf8mb4 COMMENT = '调度模型表'; |
| | | |
| | | create table |
| | | t_st_schedule_model_param |
| | | t_st_schedule_model_param |
| | | ( |
| | | id varchar(36) not null, |
| | | modelid varchar(64) not null, |
| | | modelparamname varchar(64), |
| | | modelparamid varchar(64), |
| | | modelparamorder integer, |
| | | modelparamportorder integer, |
| | | datalength integer, |
| | | modelparamtype varchar(64), |
| | | primary key (id) |
| | | id varchar(36) not null, |
| | | modelid varchar(64) not null, |
| | | modelparamname varchar(64), |
| | | modelparamid varchar(64), |
| | | modelparamorder integer, |
| | | modelparamportorder integer, |
| | | datalength integer, |
| | | modelparamtype varchar(64), |
| | | primary key (id) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '调度模型输入参数表'; |
| | | |
| | | |
| | | create table |
| | | t_st_schedule_model_setting |
| | | t_st_schedule_model_setting |
| | | ( |
| | | `id` varchar(36) not null, |
| | | `modelid` varchar(64) not null, |
| | | `key` varchar(64), |
| | | `value` varchar(64), |
| | | `valuetype` varchar(64), |
| | | `name` varchar(64), |
| | | `sort` integer, |
| | | primary key (id), |
| | | key idx_modelid (modelid) |
| | | `id` varchar(36) not null, |
| | | `modelid` varchar(64) not null, |
| | | `key` varchar(64), |
| | | `value` varchar(64), |
| | | `valuetype` varchar(64), |
| | | `name` varchar(64), |
| | | `sort` integer, |
| | | primary key (id), |
| | | key idx_modelid (modelid) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '调度模型设置参数表'; |
| | | |
| | | create table |
| | | t_st_schedule_suggest |
| | | t_st_schedule_suggest |
| | | ( |
| | | id varchar(36) not null, |
| | | title varchar(50) COMMENT '标题', |
| | | content varchar(256) COMMENT '内容', |
| | | sort integer COMMENT '排序', |
| | | scheme_id varchar(36) COMMENT '方案ID', |
| | | alarm_id varchar(36) COMMENT '预警ID', |
| | | item_id varchar(36) COMMENT '预测项ID', |
| | | model_id varchar(36) COMMENT '模型ID', |
| | | schedule_obj varchar(20) COMMENT '调整对象', |
| | | schedule_type varchar(20) COMMENT '调整类型', |
| | | schedule_strategy varchar(20) COMMENT '调整策略', |
| | | adjust_mode varchar(20) COMMENT '调整方式', |
| | | adjust_value decimal(18, 4) COMMENT '调整值', |
| | | adjust_unit varchar(20) COMMENT '调整单位', |
| | | adjust_times decimal(18, 4) COMMENT '持续时长', |
| | | adjust_start datetime COMMENT '调整开始时间', |
| | | adjust_end datetime COMMENT '调整结束时间', |
| | | schedule_time datetime COMMENT '调度时间', |
| | | status tinyint NOT NULL COMMENT '状态(0未处理 1已采纳 2已忽略)', |
| | | handler varchar(36) COMMENT '处理人', |
| | | handle_time datetime COMMENT '处理时间', |
| | | create_time datetime default current_timestamp COMMENT '创建时间', |
| | | primary key (id), |
| | | INDEX idx_scheme_id (scheme_id), |
| | | INDEX idx_alarm_id (alarm_id), |
| | | INDEX idx_item_id (item_id), |
| | | INDEX idx_model_id (model_id), |
| | | INDEX idx_schedule_obj (schedule_obj), |
| | | INDEX idx_schedule_type (schedule_type) |
| | | id varchar(36) not null, |
| | | title varchar(50) COMMENT '标题', |
| | | content varchar(256) COMMENT '内容', |
| | | sort integer COMMENT '排序', |
| | | scheme_id varchar(36) COMMENT '方案ID', |
| | | alarm_id varchar(36) COMMENT '预警ID', |
| | | item_id varchar(36) COMMENT '预测项ID', |
| | | model_id varchar(36) COMMENT '模型ID', |
| | | schedule_obj varchar(20) COMMENT '调整对象', |
| | | schedule_type varchar(20) COMMENT '调整类型', |
| | | schedule_strategy varchar(20) COMMENT '调整策略', |
| | | adjust_mode varchar(20) COMMENT '调整方式', |
| | | adjust_value decimal(18, 4) COMMENT '调整值', |
| | | adjust_unit varchar(20) COMMENT '调整单位', |
| | | adjust_times decimal(18, 4) COMMENT '持续时长', |
| | | adjust_start datetime COMMENT '调整开始时间', |
| | | adjust_end datetime COMMENT '调整结束时间', |
| | | schedule_time datetime COMMENT '调度时间', |
| | | status tinyint NOT NULL COMMENT '状态(0未处理 1已采纳 2已忽略)', |
| | | handler varchar(36) COMMENT '处理人', |
| | | handle_time datetime COMMENT '处理时间', |
| | | create_time datetime default current_timestamp COMMENT '创建时间', |
| | | primary key (id), |
| | | INDEX idx_scheme_id (scheme_id), |
| | | INDEX idx_alarm_id (alarm_id), |
| | | INDEX idx_item_id (item_id), |
| | | INDEX idx_model_id (model_id), |
| | | INDEX idx_schedule_obj (schedule_obj), |
| | | INDEX idx_schedule_type (schedule_type) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '调度建议表'; |
| | | |
| | | |
| | | create table |
| | | t_st_schedule_record |
| | | t_st_schedule_record |
| | | ( |
| | | `id` varchar(36) not null, |
| | | `scheme_id` varchar(36) COMMENT '方案ID', |
| | | `model_id` varchar(36) COMMENT '模型ID', |
| | | `model_name` varchar(64) COMMENT '模型名称', |
| | | `schedule_time` datetime COMMENT '调度时间', |
| | | `create_time` datetime default current_timestamp COMMENT '创建时间', |
| | | primary key (id), |
| | | INDEX idx_scheme_id (scheme_id), |
| | | INDEX idx_model_id (model_id), |
| | | INDEX idx_schedule_time (schedule_time) |
| | | `id` varchar(36) not null, |
| | | `scheme_id` varchar(36) COMMENT '方案ID', |
| | | `model_id` varchar(36) COMMENT '模型ID', |
| | | `model_name` varchar(64) COMMENT '模型名称', |
| | | `schedule_time` datetime COMMENT '调度时间', |
| | | `create_time` datetime default current_timestamp COMMENT '创建时间', |
| | | primary key (id), |
| | | INDEX idx_scheme_id (scheme_id), |
| | | INDEX idx_model_id (model_id), |
| | | INDEX idx_schedule_time (schedule_time) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '调度记录表'; |
| | | |
| | | |
| | | create table |
| | | t_st_schedule_record_detail |
| | | t_st_schedule_record_detail |
| | | ( |
| | | `id` varchar(36) not null, |
| | | `record_id` varchar(36), |
| | | `scheme_id` varchar(64), |
| | | `model_id` varchar(36) COMMENT '模型ID', |
| | | `result_key` varchar(64), |
| | | `result_value` text, |
| | | `schedule_time` datetime COMMENT '调度时间', |
| | | primary key (id), |
| | | key idx_record_id (record_id), |
| | | key idx_scheme_id (scheme_id), |
| | | key idx_model_id (model_id) |
| | | `id` varchar(36) not null, |
| | | `record_id` varchar(36), |
| | | `scheme_id` varchar(64), |
| | | `model_id` varchar(36) COMMENT '模型ID', |
| | | `result_key` varchar(64), |
| | | `result_value` text, |
| | | `schedule_time` datetime COMMENT '调度时间', |
| | | primary key (id), |
| | | key idx_record_id (record_id), |
| | | key idx_scheme_id (scheme_id), |
| | | key idx_model_id (model_id) |
| | | ) engine = innodb |
| | | default character set utf8mb4 COMMENT = '调度记录详情表'; |
| | | |
| | | -- mpk |
| | | |
| | | -- menu |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416369, '模型库', '', 2, 20, 1803317368415416363, 'mpk', 'ep:folder', 'mpk/mpk', 'Mpk', 0, b'1', b'1', b'1', '1', '2024-08-31 16:50:38', '1', '2024-09-10 14:53:17', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416370, 'MPK查询', 'mpk:query', 3, 0, 1803317368415416369, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-09-02 10:14:00', '1', '2024-09-06 11:50:19', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416371, 'MPK新增', 'mpk:create', 3, 1, 1803317368415416369, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-09-02 10:14:25', '1', '2024-09-06 11:50:28', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416372, 'MPK修改', 'mpk:update', 3, 2, 1803317368415416369, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-09-02 10:14:44', '1', '2024-09-06 11:50:38', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416373, 'MPK删除', 'mpk:delete', 3, 3, 1803317368415416369, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-09-02 10:15:04', '1', '2024-09-06 11:50:46', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416374, '项目管理', '', 2, 30, 1803317368415416363, 'project', 'ep:document-copy', 'mpk/project', 'Project', 0, b'1', b'1', b'1', '1', '2024-09-10 14:44:54', '1', '2024-09-10 14:53:26', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416375, '项目查询', 'project:query', 3, 0, 1803317368415416374, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-09-10 14:45:53', '1', '2024-09-10 14:45:53', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416376, '项目新增', 'project:create', 3, 1, 1803317368415416374, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-09-10 14:46:16', '1', '2024-09-10 14:46:16', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416377, '项目修改', 'project:update', 3, 2, 1803317368415416374, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-09-10 14:46:33', '1', '2024-09-10 14:46:33', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1803317368415416378, '项目删除', 'project:delete', 3, 3, 1803317368415416374, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-09-10 14:46:47', '1', '2024-09-10 14:46:47', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416369, '模型库', '', 2, 20, 1803317368415416363, 'mpk', 'ep:folder', 'mpk/mpk', 'Mpk', 0, b'1', |
| | | b'1', b'1', '1', '2024-08-31 16:50:38', '1', '2024-09-10 14:53:17', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416370, 'MPK查询', 'mpk:query', 3, 0, 1803317368415416369, '', '', '', '', 0, b'1', b'1', b'1', |
| | | '1', '2024-09-02 10:14:00', '1', '2024-09-06 11:50:19', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416371, 'MPK新增', 'mpk:create', 3, 1, 1803317368415416369, '', '', '', '', 0, b'1', b'1', b'1', |
| | | '1', '2024-09-02 10:14:25', '1', '2024-09-06 11:50:28', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416372, 'MPK修改', 'mpk:update', 3, 2, 1803317368415416369, '', '', '', '', 0, b'1', b'1', b'1', |
| | | '1', '2024-09-02 10:14:44', '1', '2024-09-06 11:50:38', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416373, 'MPK删除', 'mpk:delete', 3, 3, 1803317368415416369, '', '', '', '', 0, b'1', b'1', b'1', |
| | | '1', '2024-09-02 10:15:04', '1', '2024-09-06 11:50:46', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416374, '项目管理', '', 2, 30, 1803317368415416363, 'project', 'ep:document-copy', 'mpk/project', |
| | | 'Project', 0, b'1', b'1', b'1', '1', '2024-09-10 14:44:54', '1', '2024-09-10 14:53:26', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416375, '项目查询', 'project:query', 3, 0, 1803317368415416374, '', '', '', '', 0, b'1', b'1', |
| | | b'1', '1', '2024-09-10 14:45:53', '1', '2024-09-10 14:45:53', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416376, '项目新增', 'project:create', 3, 1, 1803317368415416374, '', '', '', '', 0, b'1', b'1', |
| | | b'1', '1', '2024-09-10 14:46:16', '1', '2024-09-10 14:46:16', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416377, '项目修改', 'project:update', 3, 2, 1803317368415416374, '', '', '', '', 0, b'1', b'1', |
| | | b'1', '1', '2024-09-10 14:46:33', '1', '2024-09-10 14:46:33', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`) |
| | | VALUES (1803317368415416378, '项目删除', 'project:delete', 3, 3, 1803317368415416374, '', '', '', '', 0, b'1', b'1', |
| | | b'1', '1', '2024-09-10 14:46:47', '1', '2024-09-10 14:46:47', b'0'); |
| | | |
| | | |
| | | -- config |
| | | --INSERT INTO `iailab_plat_system`.`infra_config` (`id`, `category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (13, 'model', 2, 'model文件备份路径', 'mpkBakFilePath', 'C:\\DLUT\\mpkBakFile', b'1', 'model文件备份路径', '1', '2024-09-12 11:10:25', '1', '2024-09-12 11:10:25', b'0'); |
| | | |
| | | -- dist |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (618, '模型方法', 'model_method', 0, '', '1', '2024-09-09 16:11:55', '1', '2024-09-09 16:11:55', b'0', '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (619, '模型类型', 'model_type', 0, '', '1', '2024-09-13 14:14:26', '1', '2024-09-13 14:14:26', b'0', '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (620, '模型方法输入类型', 'model_method_setting_type', 0, '', '1', '2024-09-13 15:41:38', '1', '2024-09-13 15:41:38', b'0', '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (621, '模型方法参数类型', 'model_method_setting_value_type', 0, '', '1', '2024-09-13 15:42:27', '1', '2024-09-13 15:42:27', b'0', '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`, `deleted_time`) |
| | | VALUES (618, '模型方法', 'model_method', 0, '', '1', '2024-09-09 16:11:55', '1', '2024-09-09 16:11:55', b'0', |
| | | '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`, `deleted_time`) |
| | | VALUES (619, '模型类型', 'model_type', 0, '', '1', '2024-09-13 14:14:26', '1', '2024-09-13 14:14:26', b'0', |
| | | '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`, `deleted_time`) |
| | | VALUES (620, '模型方法输入类型', 'model_method_setting_type', 0, '', '1', '2024-09-13 15:41:38', '1', |
| | | '2024-09-13 15:41:38', b'0', '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`, `deleted_time`) |
| | | VALUES (621, '模型方法参数类型', 'model_method_setting_value_type', 0, '', '1', '2024-09-13 15:42:27', '1', |
| | | '2024-09-13 15:42:27', b'0', '1970-01-01 00:00:00'); |
| | | |
| | | |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1536, 1, 'train', 'train', 'model_method', 0, '', '', '', '1', '2024-09-09 16:12:42', '1', '2024-09-09 16:12:42', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1537, 3, 'control', 'control', 'model_method', 0, '', '', '', '1', '2024-09-09 16:12:54', '1', '2024-09-09 16:13:10', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1538, 2, 'predict', 'predict', 'model_method', 0, '', '', '', '1', '2024-09-09 16:13:05', '1', '2024-09-09 16:13:05', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1539, 1, '预测模型', 'predict', 'model_type', 0, '', '', '', '1', '2024-09-13 14:14:58', '1', '2024-09-13 14:14:58', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1540, 2, '调度模型', 'schedul', 'model_type', 0, '', '', '', '1', '2024-09-13 14:17:53', '1', '2024-09-13 14:17:53', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1541, 1, 'input', 'input', 'model_method_setting_type', 0, '', '', '', '1', '2024-09-13 15:44:08', '1', '2024-09-13 15:44:08', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1542, 2, 'select', 'select', 'model_method_setting_type', 0, '', '', '', '1', '2024-09-13 15:44:17', '1', '2024-09-13 15:44:17', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1543, 3, 'file', 'file', 'model_method_setting_type', 0, '', '', '', '1', '2024-09-13 15:44:24', '1', '2024-09-13 15:44:24', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1544, 1, 'int', 'int', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:44:42', '1', '2024-09-13 15:44:42', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1545, 5, 'file', 'file', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:44:57', '1', '2024-09-14 14:16:24', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1546, 3, 'decimal', 'decimal', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:45:21', '1', '2024-09-13 15:45:21', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1547, 4, 'decimalArray', 'decimalArray', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:45:26', '1', '2024-09-13 15:45:26', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1548, 2, 'string', 'string', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:45:36', '1', '2024-09-14 14:16:30', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1549, 4, 'schedul', 'schedul', 'model_method', 0, '', '', '', '1', '2024-09-14 14:56:44', '1', '2024-09-14 14:56:44', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1536, 1, 'train', 'train', 'model_method', 0, '', '', '', '1', '2024-09-09 16:12:42', '1', |
| | | '2024-09-09 16:12:42', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1537, 3, 'control', 'control', 'model_method', 0, '', '', '', '1', '2024-09-09 16:12:54', '1', |
| | | '2024-09-09 16:13:10', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1538, 2, 'predict', 'predict', 'model_method', 0, '', '', '', '1', '2024-09-09 16:13:05', '1', |
| | | '2024-09-09 16:13:05', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1539, 1, '预测模型', 'predict', 'model_type', 0, '', '', '', '1', '2024-09-13 14:14:58', '1', |
| | | '2024-09-13 14:14:58', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1540, 2, '调度模型', 'schedul', 'model_type', 0, '', '', '', '1', '2024-09-13 14:17:53', '1', |
| | | '2024-09-13 14:17:53', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1541, 1, 'input', 'input', 'model_method_setting_type', 0, '', '', '', '1', '2024-09-13 15:44:08', '1', |
| | | '2024-09-13 15:44:08', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1542, 2, 'select', 'select', 'model_method_setting_type', 0, '', '', '', '1', '2024-09-13 15:44:17', '1', |
| | | '2024-09-13 15:44:17', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1543, 3, 'file', 'file', 'model_method_setting_type', 0, '', '', '', '1', '2024-09-13 15:44:24', '1', |
| | | '2024-09-13 15:44:24', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1544, 1, 'int', 'int', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:44:42', '1', |
| | | '2024-09-13 15:44:42', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1545, 5, 'file', 'file', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:44:57', '1', |
| | | '2024-09-14 14:16:24', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1546, 3, 'decimal', 'decimal', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:45:21', |
| | | '1', '2024-09-13 15:45:21', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1547, 4, 'decimalArray', 'decimalArray', 'model_method_setting_value_type', 0, '', '', '', '1', |
| | | '2024-09-13 15:45:26', '1', '2024-09-13 15:45:26', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1548, 2, 'string', 'string', 'model_method_setting_value_type', 0, '', '', '', '1', '2024-09-13 15:45:36', '1', |
| | | '2024-09-14 14:16:30', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, |
| | | `color_type`, `css_class`, `remark`, `creator`, `create_time`, |
| | | `updater`, `update_time`, `deleted`) |
| | | VALUES (1549, 4, 'schedul', 'schedul', 'model_method', 0, '', '', '', '1', '2024-09-14 14:56:44', '1', |
| | | '2024-09-14 14:56:44', b'0'); |
| | | |
| | | |
| | | -- 业务表 |
| | | DROP TABLE IF EXISTS `t_mpk_file`; |
| | | CREATE TABLE `t_mpk_file` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `py_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型名称', |
| | | `py_chinese_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型中文名称', |
| | | `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '源文件保存路径', |
| | | `py_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型类型', |
| | | `pkg_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '包名', |
| | | `class_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '类名', |
| | | `py_module` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型路径', |
| | | `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'icon图片名', |
| | | `menu_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属菜单', |
| | | `group_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属组', |
| | | `remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', |
| | | `creator` bigint NULL DEFAULT NULL COMMENT '创建者', |
| | | `create_date` datetime NULL DEFAULT NULL COMMENT '创建时间', |
| | | `updater` bigint NULL DEFAULT NULL COMMENT '更新者', |
| | | `update_date` datetime NULL DEFAULT NULL COMMENT '更新时间', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE INDEX `uk_py_name`(`py_name` ASC) USING BTREE, |
| | | INDEX `idx_create_date`(`create_date` ASC) USING BTREE |
| | | CREATE TABLE `t_mpk_file` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `py_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型名称', |
| | | `py_chinese_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型中文名称', |
| | | `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '源文件保存路径', |
| | | `py_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型类型', |
| | | `pkg_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '包名', |
| | | `class_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '类名', |
| | | `py_module` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型路径', |
| | | `icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'icon图片名', |
| | | `menu_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属菜单', |
| | | `group_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '所属组', |
| | | `remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', |
| | | `creator` bigint NULL DEFAULT NULL COMMENT '创建者', |
| | | `create_date` datetime NULL DEFAULT NULL COMMENT '创建时间', |
| | | `updater` bigint NULL DEFAULT NULL COMMENT '更新者', |
| | | `update_date` datetime NULL DEFAULT NULL COMMENT '更新时间', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE INDEX `uk_py_name`(`py_name` ASC) USING BTREE, |
| | | INDEX `idx_create_date`(`create_date` ASC) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MDK模型文件' ROW_FORMAT = DYNAMIC; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_mpk_generator_code_history |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_mpk_generator_code_history`; |
| | | CREATE TABLE `t_mpk_generator_code_history` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `mdk_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'mdk_id', |
| | | `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文件名', |
| | | `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文件保存路径', |
| | | `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '生成时间', |
| | | PRIMARY KEY (`id`, `mdk_id`) USING BTREE, |
| | | INDEX `del_code_history`(`mdk_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_code_history` FOREIGN KEY (`mdk_id`) REFERENCES `t_mpk_file` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | CREATE TABLE `t_mpk_generator_code_history` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `mdk_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'mdk_id', |
| | | `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文件名', |
| | | `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文件保存路径', |
| | | `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '生成时间', |
| | | PRIMARY KEY (`id`, `mdk_id`) USING BTREE, |
| | | INDEX `del_code_history`(`mdk_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_code_history` FOREIGN KEY (`mdk_id`) REFERENCES `t_mpk_file` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '生成代码记录表' ROW_FORMAT = DYNAMIC; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_mpk_model_method |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_mpk_model_method`; |
| | | CREATE TABLE `t_mpk_model_method` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `mpk_file_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '模型文件id', |
| | | `method_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型方法名', |
| | | `data_length` int NULL DEFAULT 1 COMMENT '输入个数', |
| | | `model` int NULL DEFAULT 0 COMMENT '是否有model(0:否,1:是)', |
| | | `result_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '结果key', |
| | | `sort` integer, |
| | | PRIMARY KEY (`id`, `mpk_file_id`) USING BTREE, |
| | | INDEX `id`(`id` ASC) USING BTREE, |
| | | INDEX `idx_method`(`mpk_file_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_method` FOREIGN KEY (`mpk_file_id`) REFERENCES `t_mpk_file` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | CREATE TABLE `t_mpk_model_method` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `mpk_file_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '模型文件id', |
| | | `method_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型方法名', |
| | | `data_length` int NULL DEFAULT 1 COMMENT '输入个数', |
| | | `model` int NULL DEFAULT 0 COMMENT '是否有model(0:否,1:是)', |
| | | `result_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '结果key', |
| | | `sort` integer, |
| | | PRIMARY KEY (`id`, `mpk_file_id`) USING BTREE, |
| | | INDEX `id`(`id` ASC) USING BTREE, |
| | | INDEX `idx_method`(`mpk_file_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_method` FOREIGN KEY (`mpk_file_id`) REFERENCES `t_mpk_file` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_mpk_method_setting |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_mpk_method_setting`; |
| | | CREATE TABLE `t_mpk_method_setting` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `method_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '方法id', |
| | | `setting_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'key', |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数名称', |
| | | `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数默认值', |
| | | `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '输入类型', |
| | | `value_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数类型', |
| | | `max` int NULL DEFAULT NULL COMMENT '最大值', |
| | | `min` int NULL DEFAULT NULL COMMENT '最小值', |
| | | `sort` integer, |
| | | PRIMARY KEY (`id`, `method_id`) USING BTREE, |
| | | INDEX `del_setting`(`method_id` ASC) USING BTREE, |
| | | INDEX `id`(`id` ASC) USING BTREE, |
| | | CONSTRAINT `del_setting` FOREIGN KEY (`method_id`) REFERENCES `t_mpk_model_method` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | CREATE TABLE `t_mpk_method_setting` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `method_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '方法id', |
| | | `setting_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'key', |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数名称', |
| | | `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数默认值', |
| | | `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '输入类型', |
| | | `value_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '参数类型', |
| | | `max` int NULL DEFAULT NULL COMMENT '最大值', |
| | | `min` int NULL DEFAULT NULL COMMENT '最小值', |
| | | `sort` integer, |
| | | PRIMARY KEY (`id`, `method_id`) USING BTREE, |
| | | INDEX `del_setting`(`method_id` ASC) USING BTREE, |
| | | INDEX `id`(`id` ASC) USING BTREE, |
| | | CONSTRAINT `del_setting` FOREIGN KEY (`method_id`) REFERENCES `t_mpk_model_method` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '方法参数关联表' ROW_FORMAT = Dynamic; |
| | | |
| | | |
| | |
| | | -- Table structure for t_mpk_setting_select |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_mpk_setting_select`; |
| | | CREATE TABLE `t_mpk_setting_select` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `setting_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '参数id', |
| | | `select_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'key', |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '名称', |
| | | `sort` integer, |
| | | PRIMARY KEY (`id`, `setting_id`) USING BTREE, |
| | | INDEX `del_select`(`setting_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_select` FOREIGN KEY (`setting_id`) REFERENCES `t_mpk_method_setting` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | CREATE TABLE `t_mpk_setting_select` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `setting_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '参数id', |
| | | `select_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'key', |
| | | `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '名称', |
| | | `sort` integer, |
| | | PRIMARY KEY (`id`, `setting_id`) USING BTREE, |
| | | INDEX `del_select`(`setting_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_select` FOREIGN KEY (`setting_id`) REFERENCES `t_mpk_method_setting` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '参数选项关联表' ROW_FORMAT = Dynamic; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_mpk_project |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_mpk_project`; |
| | | CREATE TABLE `t_mpk_project` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `project_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目名称', |
| | | `project_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目编码', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', |
| | | `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | CREATE TABLE `t_mpk_project` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `project_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目名称', |
| | | `project_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '项目编码', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', |
| | | `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '项目表' ROW_FORMAT = DYNAMIC; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_mpk_project_model |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_mpk_project_model`; |
| | | CREATE TABLE `t_mpk_project_model` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `project_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目id', |
| | | `model_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '模型id', |
| | | PRIMARY KEY (`id`, `project_id`, `model_id`) USING BTREE, |
| | | INDEX `del_p`(`project_id` ASC) USING BTREE, |
| | | INDEX `del_m`(`model_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_m` FOREIGN KEY (`model_id`) REFERENCES `t_mpk_file` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT, |
| | | CONSTRAINT `del_p` FOREIGN KEY (`project_id`) REFERENCES `t_mpk_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | CREATE TABLE `t_mpk_project_model` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `project_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目id', |
| | | `model_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '模型id', |
| | | PRIMARY KEY (`id`, `project_id`, `model_id`) USING BTREE, |
| | | INDEX `del_p`(`project_id` ASC) USING BTREE, |
| | | INDEX `del_m`(`model_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_m` FOREIGN KEY (`model_id`) REFERENCES `t_mpk_file` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT, |
| | | CONSTRAINT `del_p` FOREIGN KEY (`project_id`) REFERENCES `t_mpk_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '项目模型关联表' ROW_FORMAT = DYNAMIC; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_mpk_project_package_history |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_mpk_project_package_history`; |
| | | CREATE TABLE `t_mpk_project_package_history` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `project_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目id', |
| | | `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文件名', |
| | | `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文件路径', |
| | | `version` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '版本号', |
| | | `log` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新日志', |
| | | `model_names` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '打包模型名称(“,”分割)', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', |
| | | PRIMARY KEY (`id`, `project_id`) USING BTREE, |
| | | INDEX `del_package_history`(`project_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_package_history` FOREIGN KEY (`project_id`) REFERENCES `t_mpk_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | CREATE TABLE `t_mpk_project_package_history` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `project_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目id', |
| | | `file_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文件名', |
| | | `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '文件路径', |
| | | `version` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '版本号', |
| | | `log` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新日志', |
| | | `model_names` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '打包模型名称(“,”分割)', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', |
| | | PRIMARY KEY (`id`, `project_id`) USING BTREE, |
| | | INDEX `del_package_history`(`project_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_package_history` FOREIGN KEY (`project_id`) REFERENCES `t_mpk_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '项目打包历史记录表' ROW_FORMAT = DYNAMIC; |
| | | |
| | | -- ---------------------------- |
| | | -- Table structure for t_mpk_project_package_history_model |
| | | -- ---------------------------- |
| | | DROP TABLE IF EXISTS `t_mpk_project_package_history_model`; |
| | | CREATE TABLE `t_mpk_project_package_history_model` ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `project_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目id', |
| | | `package_history_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '打包历史id', |
| | | `py_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型名称', |
| | | `pkg_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '包名', |
| | | `py_module` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型路径', |
| | | `remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型备注', |
| | | `method_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '模型方法信息', |
| | | PRIMARY KEY (`id`, `project_id`) USING BTREE, |
| | | INDEX `del_package_model`(`project_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_package_model` FOREIGN KEY (`project_id`) REFERENCES `t_mpk_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | CREATE TABLE `t_mpk_project_package_history_model` |
| | | ( |
| | | `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT 'id', |
| | | `project_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '项目id', |
| | | `package_history_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '打包历史id', |
| | | `py_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型名称', |
| | | `pkg_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '包名', |
| | | `py_module` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型路径', |
| | | `remark` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '模型备注', |
| | | `method_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '模型方法信息', |
| | | PRIMARY KEY (`id`, `project_id`) USING BTREE, |
| | | INDEX `del_package_model`(`project_id` ASC) USING BTREE, |
| | | CONSTRAINT `del_package_model` FOREIGN KEY (`project_id`) REFERENCES `t_mpk_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '打包历史模型关联表' ROW_FORMAT = Dynamic; |
| | | |
| | | |
| | | DROP TABLE IF EXISTS `t_mpk_icon`; |
| | | CREATE TABLE `t_mpk_icon` ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `icon_name` varchar(36) NOT NULL COMMENT '图标名称', |
| | | `icon_desc` varchar(36) DEFAULT NULL COMMENT '图标描述', |
| | | `sort` integer DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | CREATE TABLE `t_mpk_icon` |
| | | ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `icon_name` varchar(36) NOT NULL COMMENT '图标名称', |
| | | `icon_desc` varchar(36) DEFAULT NULL COMMENT '图标描述', |
| | | `sort` integer DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MDK平台图标' ROW_FORMAT = Dynamic; |
| | | |
| | | DROP TABLE IF EXISTS `t_mpk_file_menu`; |
| | | CREATE TABLE `t_mpk_file_menu` ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `name` varchar(36) NOT NULL COMMENT '名称', |
| | | `sort` integer DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | CREATE TABLE `t_mpk_file_menu` |
| | | ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `name` varchar(36) NOT NULL COMMENT '名称', |
| | | `sort` integer DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '模型文件菜单' ROW_FORMAT = Dynamic; |
| | | |
| | | DROP TABLE IF EXISTS `t_mpk_file_group`; |
| | | CREATE TABLE `t_mpk_file_group` ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `menu_id` varchar(36) NOT NULL COMMENT '菜单', |
| | | `name` varchar(36) NOT NULL COMMENT '名称', |
| | | `sort` integer DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | CREATE TABLE `t_mpk_file_group` |
| | | ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `menu_id` varchar(36) NOT NULL COMMENT '菜单', |
| | | `name` varchar(36) NOT NULL COMMENT '名称', |
| | | `sort` integer DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '模型文件分组' ROW_FORMAT = Dynamic; |
| | | |
| | | alter table t_mm_predict_model add column `mpkprojectid` varchar(36) DEFAULT NULL; |
| | | alter table t_mm_predict_model |
| | | add column `mpkprojectid` varchar(36) DEFAULT NULL; |
| | | |
| | | -- chart 图表配置 |
| | | |
| | | -- menu |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `app_id`, `tenant_id`) VALUES (1803317368435416399, '图表管理', '', 1, 40, 1803317368415416363, 'chart', 'fa:align-left', '', '', 0, b'1', b'1', b'1', '1', '2024-11-05 11:57:25', '1', '2024-11-05 11:57:49', b'0', 0, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `app_id`, `tenant_id`) VALUES (1803317368435416400, '图表配置', '', 2, 1, 1803317368435416399, 'chartParam', 'fa-solid:cogs', 'model/chart/index', 'ChartParam', 0, b'1', b'1', b'1', '1', '2024-11-05 12:01:59', '1', '2024-11-06 08:45:17', b'0', 0, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `app_id`, `tenant_id`) VALUES (1803317368435416401, '查询', 'model:chart:query', 3, 1, 1803317368435416400, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-11-05 15:36:48', '1', '2024-11-05 15:36:48', b'0', NULL, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `app_id`, `tenant_id`) VALUES (1803317368435416402, '新增', 'model:chart:create', 3, 2, 1803317368435416400, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-11-05 15:37:03', '1', '2024-11-05 15:37:03', b'0', NULL, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `app_id`, `tenant_id`) VALUES (1803317368435416403, '修改', 'model:chart:update', 3, 3, 1803317368435416400, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-11-05 15:37:20', '1', '2024-11-05 15:37:20', b'0', NULL, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `app_id`, `tenant_id`) VALUES (1803317368435416404, '删除', 'model:chart:delete', 3, 4, 1803317368435416400, '', '', '', '', 0, b'1', b'1', b'1', '1', '2024-11-05 15:37:38', '1', '2024-11-05 15:37:38', b'0', NULL, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`, `app_id`, `tenant_id`) |
| | | VALUES (1803317368435416399, '图表管理', '', 1, 40, 1803317368415416363, 'chart', 'fa:align-left', '', '', 0, b'1', |
| | | b'1', b'1', '1', '2024-11-05 11:57:25', '1', '2024-11-05 11:57:49', b'0', 0, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`, `app_id`, `tenant_id`) |
| | | VALUES (1803317368435416400, '图表配置', '', 2, 1, 1803317368435416399, 'chartParam', 'fa-solid:cogs', |
| | | 'model/chart/index', 'ChartParam', 0, b'1', b'1', b'1', '1', '2024-11-05 12:01:59', '1', '2024-11-06 08:45:17', |
| | | b'0', 0, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`, `app_id`, `tenant_id`) |
| | | VALUES (1803317368435416401, '查询', 'model:chart:query', 3, 1, 1803317368435416400, '', '', '', '', 0, b'1', b'1', |
| | | b'1', '1', '2024-11-05 15:36:48', '1', '2024-11-05 15:36:48', b'0', NULL, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`, `app_id`, `tenant_id`) |
| | | VALUES (1803317368435416402, '新增', 'model:chart:create', 3, 2, 1803317368435416400, '', '', '', '', 0, b'1', b'1', |
| | | b'1', '1', '2024-11-05 15:37:03', '1', '2024-11-05 15:37:03', b'0', NULL, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`, `app_id`, `tenant_id`) |
| | | VALUES (1803317368435416403, '修改', 'model:chart:update', 3, 3, 1803317368435416400, '', '', '', '', 0, b'1', b'1', |
| | | b'1', '1', '2024-11-05 15:37:20', '1', '2024-11-05 15:37:20', b'0', NULL, 1); |
| | | INSERT INTO `iailab_plat_system`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, |
| | | `component`, `component_name`, `status`, `visible`, `keep_alive`, |
| | | `always_show`, `creator`, `create_time`, `updater`, `update_time`, |
| | | `deleted`, `app_id`, `tenant_id`) |
| | | VALUES (1803317368435416404, '删除', 'model:chart:delete', 3, 4, 1803317368435416400, '', '', '', '', 0, b'1', b'1', |
| | | b'1', '1', '2024-11-05 15:37:38', '1', '2024-11-05 15:37:38', b'0', NULL, 1); |
| | | |
| | | -- table |
| | | CREATE TABLE `t_chart` ( |
| | | `id` varchar(36) NOT NULL, |
| | | `chart_name` varchar(100) DEFAULT NULL COMMENT '图表名称', |
| | | `chart_code` varchar(100) DEFAULT NULL COMMENT '图表编码', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', |
| | | `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_chart_code` (`chart_code`), |
| | | KEY `index_id` (`id`) |
| | | CREATE TABLE `t_chart` |
| | | ( |
| | | `id` varchar(36) NOT NULL, |
| | | `chart_name` varchar(100) DEFAULT NULL COMMENT '图表名称', |
| | | `chart_code` varchar(100) DEFAULT NULL COMMENT '图表编码', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', |
| | | `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', |
| | | PRIMARY KEY (`id`), |
| | | UNIQUE KEY `uk_chart_code` (`chart_code`), |
| | | KEY `index_id` (`id`) |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='图表配置'; |
| | | |
| | | CREATE TABLE `t_chart_param` ( |
| | | `id` varchar(36) NOT NULL, |
| | | `chart_id` varchar(36) NOT NULL COMMENT '图表id', |
| | | `param_name` varchar(255) DEFAULT NULL COMMENT '参数名称', |
| | | `param_code` varchar(100) DEFAULT NULL COMMENT '参数编码', |
| | | `param_value` varchar(1000) DEFAULT NULL COMMENT '参数值', |
| | | `remark` varchar(255) DEFAULT NULL COMMENT '备注', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', |
| | | `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', |
| | | PRIMARY KEY (`id`,`chart_id`) USING BTREE, |
| | | KEY `index_chart_id` (`chart_id`), |
| | | CONSTRAINT `chart_id` FOREIGN KEY (`chart_id`) REFERENCES `t_chart` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | CREATE TABLE `t_chart_param` |
| | | ( |
| | | `id` varchar(36) NOT NULL, |
| | | `chart_id` varchar(36) NOT NULL COMMENT '图表id', |
| | | `param_name` varchar(255) DEFAULT NULL COMMENT '参数名称', |
| | | `param_code` varchar(100) DEFAULT NULL COMMENT '参数编码', |
| | | `param_value` varchar(1000) DEFAULT NULL COMMENT '参数值', |
| | | `remark` varchar(255) DEFAULT NULL COMMENT '备注', |
| | | `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间', |
| | | `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间', |
| | | PRIMARY KEY (`id`, `chart_id`) USING BTREE, |
| | | KEY `index_chart_id` (`chart_id`), |
| | | CONSTRAINT `chart_id` FOREIGN KEY (`chart_id`) REFERENCES `t_chart` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT |
| | | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='图表参数配置'; |
| | | |
| | | |
| | | DROP TABLE IF EXISTS `t_mpk_pack`; |
| | | CREATE TABLE `t_mpk_pack` ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `pack_name` varchar(50) NOT NULL COMMENT '包名称', |
| | | `pack_desc` varchar(50) DEFAULT NULL COMMENT '包描述', |
| | | `model_path` varchar(50) DEFAULT NULL COMMENT '模型路径', |
| | | `sort` integer DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE INDEX uk_pack_name (pack_name) |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MDK包名管理' ROW_FORMAT = Dynamic; |
| | | CREATE TABLE `t_mpk_pack` |
| | | ( |
| | | `id` varchar(36) NOT NULL COMMENT 'id', |
| | | `pack_name` varchar(50) NOT NULL COMMENT '包名称', |
| | | `pack_desc` varchar(50) DEFAULT NULL COMMENT '包描述', |
| | | `model_path` varchar(50) DEFAULT NULL COMMENT '模型路径', |
| | | `sort` integer DEFAULT NULL COMMENT '排序', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE INDEX uk_pack_name (pack_name) |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'MDK包名管理' ROW_FORMAT = Dynamic; |
| | | |
| | | |
| | | create table |
| | | t_mm_item_status |
| | | ( |
| | | id varchar(36) not null COMMENT 'id', |
| | | item_id varchar(36) COMMENT '预测项ID', |
| | | last_time datetime DEFAULT NULL COMMENT '最新运行时间', |
| | | status smallint DEFAULT NULL COMMENT '运行状态', |
| | | duration bigint(20) DEFAULT NULL COMMENT '耗时(s)', |
| | | primary key (id), |
| | | UNIQUE INDEX uk_item_id (item_id) |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '测项状态表' ROW_FORMAT = Dynamic; |
| | | |
| | | -- 模型输出 |
| | | ALTER TABLE t_mm_predict_model DROP COLUMN `resultstrid`; |
| | | alter table t_mm_item_output add column `resultstr` varchar(50) DEFAULT NULL; |
| | | alter table t_mm_item_output add column `result_type` smallint DEFAULT NULL COMMENT '参数类型{1:一维数组;2:二维数组}'; |
| | | alter table t_mm_item_output add column `result_index` int DEFAULT NULL; |
| | | |
| | | -- 字典 |
| | | INSERT INTO `iailab_plat_system`.`system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (644, '模型结果数据类型', 'model_result_type', 0, '', '141', '2024-11-11 15:16:58', '141', '2024-11-11 15:16:58', b'0', '1970-01-01 00:00:00'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1628, 1, 'double[]', '1', 'model_result_type', 0, '', '', '', '141', '2024-11-11 15:21:05', '141', '2024-11-11 15:21:05', b'0'); |
| | | INSERT INTO `iailab_plat_system`.`system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1629, 2, 'double[][]', '2', 'model_result_type', 0, '', '', '', '141', '2024-11-11 15:21:17', '141', '2024-11-11 15:21:17', b'0'); |
| | | |
| | | |
| | | alter table t_mm_item_output add column `result_name` varchar(50) DEFAULT NULL; |
对比新文件 |
| | |
| | | package com.iailab.module.model.api; |
| | | |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueDTO; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mcs.dto.*; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.service.*; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月13日 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @Validated |
| | | public class McsApiImpl implements McsApi { |
| | | |
| | | @Autowired |
| | | private DmModuleService dmModuleService; |
| | | |
| | | @Autowired |
| | | private MmPredictItemService mmPredictItemService; |
| | | |
| | | @Autowired |
| | | private MmItemOutputService mmItemOutputService; |
| | | |
| | | @Autowired |
| | | private MmItemResultService mmItemResultService; |
| | | |
| | | @Autowired |
| | | private MmItemResultLastPointService mmItemResultLastPointService; |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | private int HOUR_MINS = 60; |
| | | |
| | | @Override |
| | | public List<PredictItemTreeDTO> getPredictItemTree() { |
| | | List<PredictItemTreeDTO> result = new ArrayList<>(); |
| | | |
| | | List<DmModuleEntity> moduleList = dmModuleService.list(new HashMap<>()); |
| | | if (CollectionUtils.isEmpty(moduleList)) { |
| | | return result; |
| | | } |
| | | moduleList.forEach(item -> { |
| | | PredictItemTreeDTO moduleOpt = new PredictItemTreeDTO(); |
| | | moduleOpt.setId(item.getId()); |
| | | moduleOpt.setLabel(item.getModulename()); |
| | | List<PredictItemTreeDTO> children = new ArrayList<>(); |
| | | Map<String, Object> params = new HashMap<>(2); |
| | | params.put("status", 1); |
| | | params.put("moduleid", item.getId()); |
| | | List<MmPredictItemRespVO> itemList = mmPredictItemService.list(params); |
| | | itemList.forEach(item1 -> { |
| | | PredictItemTreeDTO chd = new PredictItemTreeDTO(); |
| | | chd.setLabel(item1.getItemname()); |
| | | chd.setId(item1.getId()); |
| | | children.add(chd); |
| | | }); |
| | | moduleOpt.setChildren(children); |
| | | result.add(moduleOpt); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public PreDataBarLineRespVO getPreDataCharts(PreDataBarLineReqVO reqVO) { |
| | | PreDataBarLineRespVO result = new PreDataBarLineRespVO(); |
| | | List<String[]> queryIds = reqVO.getQueryIds(); |
| | | List<String> legends = new ArrayList<>(); |
| | | List<PreDataViewRespDTO> dataViewList = new ArrayList<>(); |
| | | if (CollectionUtils.isEmpty(reqVO.getQueryIds())) { |
| | | return result; |
| | | } |
| | | Date predictTime = reqVO.getPredictTime(); |
| | | if (predictTime == null) { |
| | | DmModuleEntity dmModule = dmModuleService.getModuleByItemId(queryIds.get(0)[0]); |
| | | if (dmModule != null) { |
| | | predictTime = dmModule.getPredicttime(); |
| | | } else { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | predictTime = calendar.getTime(); |
| | | } |
| | | } |
| | | Date startTime = reqVO.getStartTime(); |
| | | if (startTime == null) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictTime); |
| | | calendar.add(Calendar.HOUR_OF_DAY, -1); |
| | | startTime = calendar.getTime(); |
| | | } |
| | | Date endTime = reqVO.getEndTime(); |
| | | if (endTime == null) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictTime); |
| | | calendar.add(Calendar.HOUR_OF_DAY, 1); |
| | | endTime = calendar.getTime(); |
| | | } |
| | | |
| | | for (int i = 0; i < queryIds.size(); i++) { |
| | | PreDataViewRespDTO viewDto = new PreDataViewRespDTO(); |
| | | String itemId = queryIds.get(i)[0]; |
| | | String outKey = queryIds.get(i)[1]; |
| | | MmItemOutputEntity output = mmItemOutputService.getByItemid(itemId, outKey); |
| | | if (output == null) { |
| | | continue; |
| | | } |
| | | legends.add(output.getResultstr()); |
| | | viewDto.setRealData(getHisData(output.getPointid(), startTime, endTime)); |
| | | viewDto.setPreDataN(mmItemResultService.getData(output.getId(), startTime, endTime)); |
| | | viewDto.setPreDataL(mmItemResultLastPointService.getData(output.getId(), startTime, endTime)); |
| | | |
| | | List<Double> values = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(viewDto.getRealData())) { |
| | | List<Double> hisValues = new ArrayList<>(); |
| | | viewDto.getRealData().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | hisValues.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | viewDto.setHisMax(new BigDecimal(hisValues.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | viewDto.setHisMin(new BigDecimal(hisValues.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | viewDto.setHisAvg(new BigDecimal(hisValues.stream().mapToDouble(Double::doubleValue).average().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | viewDto.setHisCumulant(new BigDecimal(hisValues.stream().mapToDouble(Double::doubleValue).sum()) |
| | | .divide(new BigDecimal(HOUR_MINS), 2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(viewDto.getPreDataN())) { |
| | | viewDto.getPreDataN().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | } |
| | | if (!CollectionUtils.isEmpty(viewDto.getPreDataL())) { |
| | | List<Double> preValues = new ArrayList<>(); |
| | | viewDto.getPreDataL().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | preValues.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | viewDto.setPreMax(new BigDecimal(preValues.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | viewDto.setPreMin(new BigDecimal(preValues.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | viewDto.setPreAvg(new BigDecimal(preValues.stream().mapToDouble(Double::doubleValue).average().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(viewDto.getCurData())) { |
| | | List<Double> preValues = new ArrayList<>(); |
| | | viewDto.getCurData().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | preValues.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | viewDto.setPreCumulant(new BigDecimal(preValues.stream().mapToDouble(Double::doubleValue).sum()) |
| | | .divide(new BigDecimal(HOUR_MINS), 2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(viewDto.getAdjData())) { |
| | | viewDto.getAdjData().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | } |
| | | if (!CollectionUtils.isEmpty(values)) { |
| | | viewDto.setMaxValue(new BigDecimal(values.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | viewDto.setMinValue(new BigDecimal(values.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | dataViewList.add(viewDto); |
| | | } |
| | | result.setStartTime(startTime); |
| | | result.setEndTime(endTime); |
| | | result.setPredictTime(predictTime); |
| | | result.setCategories(DateUtils.getTimeScale(startTime, endTime, 60)); |
| | | result.setLegend(legends); |
| | | result.setDataViewList(dataViewList); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 获取真实值 |
| | | * |
| | | * @param pointId |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | private List<Object[]> getHisData(String pointId, Date startTime, Date endTime) { |
| | | List<Object[]> result = new ArrayList<>(); |
| | | ApiPointDTO pointDTO = dataPointApi.getInfoById(pointId); |
| | | ApiPointValueQueryDTO queryPointDto = new ApiPointValueQueryDTO(); |
| | | queryPointDto.setPointNo(pointDTO.getPointNo()); |
| | | queryPointDto.setStart(startTime); |
| | | queryPointDto.setEnd(endTime); |
| | | List<ApiPointValueDTO> valueDTOS = dataPointApi.queryPointHistoryValue(queryPointDto); |
| | | if (CollectionUtils.isEmpty(valueDTOS)) { |
| | | return result; |
| | | } |
| | | valueDTOS.forEach(item -> { |
| | | Object[] values = new Object[2]; |
| | | values[0] = DateUtils.format(item.getDataTime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | values[1] = item.getDataValue(); |
| | | result.add(values); |
| | | }); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean createAlarmMessage(AlarmMessageRespDTO dto) { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public List<AlarmMessageRespDTO> listAlarmMessage(Map<String, Object> params) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean createScheduleSuggest(ScheduleSuggestRespDTO dto) { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public List<ScheduleSuggestRespDTO> listScheduleSuggest(ScheduleSuggestReqDTO params) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean modifyPredictModelSetting(List<PredictModelSettingReqDTO> dtos) { |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean modifyScheduleModelSetting(List<ScheduleModelSettingReqDTO> dtos) { |
| | | return true; |
| | | } |
| | | } |
| | |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.model.api.mdk.MdkApi; |
| | | import com.iailab.module.model.api.mdk.dto.*; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.service.DmModuleService; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | |
| | | @Override |
| | | public MdkPredictModuleRespDTO predictModule(MdkPredictReqDTO reqDTO) { |
| | | MdkPredictModuleRespDTO resp = new MdkPredictModuleRespDTO(); |
| | | resp.setPredictTime(reqDTO.getPredictTime()); |
| | | resp.setModuleType(reqDTO.getModuleType()); |
| | | |
| | | Map<String, MdkPredictItemRespDTO> predictItemRespMap = new HashMap<>(); |
| | | try { |
| | | if (reqDTO.getPredictTime() == null) { |
| | |
| | | if (reqDTO.getModuleType() == null) { |
| | | throw new Exception("ModuleType不能为空"); |
| | | } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(reqDTO.getPredictTime()); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | reqDTO.setPredictTime(calendar.getTime()); |
| | | log.info("预测参数:" + JSON.toJSONString(reqDTO)); |
| | | MdkPredictModuleRespDTO result = new MdkPredictModuleRespDTO(); |
| | | result.setPredictTime(reqDTO.getPredictTime()); |
| | |
| | | } |
| | | List<ItemVO> predictItemList = mmPredictItemService.getByModuleId(module.getId()); |
| | | Map<String, PredictResultVO> predictResultMap = predictModuleHandler.predict(predictItemList, reqDTO.getPredictTime(), intervalTime); |
| | | // 更新Module时间 |
| | | dmModuleService.updatePredictTime(module.getId(), reqDTO.getPredictTime()); |
| | | |
| | | if (reqDTO.getIsResult() == null || !reqDTO.getIsResult()) { |
| | | return resp; |
| | | } |
| | | |
| | | for (Map.Entry<String, PredictResultVO> entry : predictResultMap.entrySet()) { |
| | | List<MdkPredictDataDTO> predictData = entry.getValue().getPredictList().stream().map(t-> { |
| | | MdkPredictDataDTO dto1 = new MdkPredictDataDTO(); |
| | | dto1.setDataTime(t.getDataTime()); |
| | | dto1.setDataValue(t.getDataValue()); |
| | | return dto1; |
| | | }).collect(Collectors.toList()); |
| | | MdkPredictItemRespDTO itemResp = new MdkPredictItemRespDTO(); |
| | | itemResp.setItemId(entry.getValue().getPredictId()); |
| | | itemResp.setPredictData(predictData); |
| | | itemResp.setItemId(entry.getKey()); |
| | | itemResp.setPredictTime(reqDTO.getPredictTime()); |
| | | Map<String, List<MdkPredictDataDTO>> itemPredictData = new HashMap<>(); |
| | | |
| | | Map<String, List<DataValueVO>> predictLists = predictResultHandler.convertToPredictData2(entry.getValue()); |
| | | for (Map.Entry<String, List<DataValueVO>> dataListEntry : predictLists.entrySet()) { |
| | | List<MdkPredictDataDTO> predictData = dataListEntry.getValue().stream().map(t -> { |
| | | MdkPredictDataDTO dto1 = new MdkPredictDataDTO(); |
| | | dto1.setDataTime(t.getDataTime()); |
| | | dto1.setDataValue(t.getDataValue()); |
| | | return dto1; |
| | | }).collect(Collectors.toList()); |
| | | itemPredictData.put(dataListEntry.getKey(), predictData); |
| | | } |
| | | itemResp.setPredictData(itemPredictData); |
| | | predictItemRespMap.put(entry.getKey(), itemResp); |
| | | } |
| | | } |
| | |
| | | |
| | | try { |
| | | log.info("预测计算开始: " + System.currentTimeMillis()); |
| | | List<MdkPredictDataDTO> predictData = new ArrayList<>(); |
| | | Map<String, List<MdkPredictDataDTO>> predictData = new HashMap<>(); |
| | | ItemVO predictItem = itemEntityFactory.getItemByItemNo(reqDTO.getItemNo()); |
| | | PredictItemHandler predictItemHandler = (PredictItemHandler)predictItemFactory.create(predictItem.getId()); |
| | | PredictItemHandler predictItemHandler = predictItemFactory.create(predictItem.getId()); |
| | | PredictResultVO predictResult = predictItemHandler.predict(reqDTO.getPredictTime(), predictItem); |
| | | Map<String, List<DataValueVO>> resultMap = predictResultHandler.convertToPredictData(predictResult); |
| | | if (!CollectionUtils.isEmpty(resultMap)) { |
| | | for (Map.Entry<String, List<DataValueVO>> entry : resultMap.entrySet()) { |
| | | predictData = ConvertUtils.sourceToTarget(entry.getValue(), MdkPredictDataDTO.class); |
| | | List<MdkPredictDataDTO> data = ConvertUtils.sourceToTarget(entry.getValue(), MdkPredictDataDTO.class); |
| | | predictData.put(entry.getKey(), data); |
| | | } |
| | | } |
| | | resp.setPredictData(predictData); |
| | |
| | | resp.setPredictTime(reqDTO.getPredictTime()); |
| | | log.info("预测计算结束: " + System.currentTimeMillis()); |
| | | } catch (Exception ex) { |
| | | log.info("预测计算异常: " + System.currentTimeMillis(),ex); |
| | | log.info("预测计算异常: " + System.currentTimeMillis(), ex); |
| | | return resp; |
| | | } |
| | | |
| | |
| | | BigDecimal ZERO_VALUE = new BigDecimal("0"); |
| | | |
| | | String MDK_SUFFIX = ".miail"; |
| | | |
| | | String MDK_RESULT = "result"; |
| | | |
| | | String MDK_STATUS_CODE = "status_code"; |
| | | |
| | | String MDK_STATUS_100 = "100"; |
| | | } |
| | |
| | | package com.iailab.module.model.framework.rpc.config; |
| | | |
| | | import com.iailab.module.data.api.plan.PlanItemApi; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.infra.api.config.ConfigApi; |
| | | import com.iailab.module.system.api.tenant.TenantApi; |
| | |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration(proxyBeanMethods = false) |
| | | @EnableFeignClients(clients = {DataPointApi.class, ConfigApi.class, TenantApi.class}) |
| | | @EnableFeignClients(clients = {DataPointApi.class, PlanItemApi.class, ConfigApi.class, TenantApi.class}) |
| | | public class RpcConfiguration { |
| | | } |
| | |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.model.common.enums.CommonConstant; |
| | | import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictItemEntity; |
| | | import com.iailab.module.model.mcs.pre.service.DmModuleService; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | | import com.iailab.module.model.mcs.pre.vo.*; |
| | | import com.iailab.module.model.mpk.common.utils.IAILModelUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.security.PermitAll; |
| | | import java.io.File; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | |
| | | @Autowired |
| | | private MmPredictItemService mmPredictItemService; |
| | | |
| | | @Autowired |
| | | private DmModuleService dmModuleService; |
| | | |
| | | @Autowired |
| | | private MmItemOutputService mmItemOutputService; |
| | | |
| | | private int HOUR_MINS = 60; |
| | | /** |
| | | * 预测项列表 |
| | | */ |
| | |
| | | file.transferTo(new File(uploadDir)); |
| | | Map<String, Object> result = iAILModelUtil.parseModel(uploadDir); |
| | | result.put("originalFilename", file.getOriginalFilename().replace(CommonConstant.MDK_SUFFIX, "")); |
| | | return success(result); |
| | | } |
| | | |
| | | @GetMapping("/tree") |
| | | public CommonResult<List<PreItemOptionVO>> itemTree() { |
| | | List<PreItemOptionVO> result = new ArrayList<>(); |
| | | |
| | | List<DmModuleEntity> moduleList = dmModuleService.list(new HashMap<>()); |
| | | if (CollectionUtils.isEmpty(moduleList)) { |
| | | return success(result); |
| | | } |
| | | moduleList.forEach(item -> { |
| | | PreItemOptionVO moduleOpt = new PreItemOptionVO(); |
| | | moduleOpt.setId(item.getId()); |
| | | moduleOpt.setLabel(item.getModulename()); |
| | | List<PreItemOptionVO> children = new ArrayList<>(); |
| | | Map<String, Object> params = new HashMap<>(2); |
| | | params.put("status", 1); |
| | | params.put("moduleid", item.getId()); |
| | | List<MmPredictItemRespVO> itemList = mmPredictItemService.list(params); |
| | | itemList.forEach(item1 -> { |
| | | PreItemOptionVO chd = new PreItemOptionVO(); |
| | | chd.setLabel(item1.getItemname()); |
| | | chd.setId(item1.getId()); |
| | | children.add(chd); |
| | | }); |
| | | moduleOpt.setChildren(children); |
| | | result.add(moduleOpt); |
| | | }); |
| | | return success(result); |
| | | } |
| | | |
| | | @GetMapping("/view-charts") |
| | | public CommonResult<PreDataBarLineVO> viewCharts(@RequestParam Map<String, Object> params) { |
| | | PreDataBarLineVO result = new PreDataBarLineVO(); |
| | | List<String> legends = new ArrayList<>(); |
| | | List<PreDataViewVO> dataViewList = new ArrayList<>(); |
| | | if (params.get("itemIds") == null) { |
| | | return success(result); |
| | | } |
| | | List<String> itemIdList = Arrays.asList(params.get("itemIds").toString().split(",")); |
| | | |
| | | Date predictTime; |
| | | if (StringUtils.isBlank((String) params.get("predictTime"))) { |
| | | DmModuleEntity dmModule = dmModuleService.getModuleByItemId(itemIdList.get(0)); |
| | | if (dmModule != null) { |
| | | predictTime = dmModule.getPredicttime(); |
| | | } else { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | predictTime = calendar.getTime(); |
| | | } |
| | | } else { |
| | | predictTime = DateUtils.parse(params.get("predictTime").toString(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | } |
| | | Date startTime; |
| | | if (StringUtils.isBlank((String) params.get("startTime"))) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictTime); |
| | | calendar.add(Calendar.HOUR_OF_DAY, -1); |
| | | startTime = calendar.getTime(); |
| | | } else { |
| | | startTime = DateUtils.parse(params.get("startTime").toString(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | } |
| | | Date endTime = null; |
| | | if (StringUtils.isBlank((String) params.get("endTime"))) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictTime); |
| | | calendar.add(Calendar.HOUR_OF_DAY, 1); |
| | | endTime = calendar.getTime(); |
| | | } else { |
| | | endTime = DateUtils.parse(params.get("endTime").toString(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | } |
| | | |
| | | for (int i = 0; i < itemIdList.size(); i++) { |
| | | PreDataViewVO viewDto = new PreDataViewVO(); |
| | | String itemId = itemIdList.get(i); |
| | | MmItemOutputEntity mmItemOutput = mmItemOutputService.getByItemid(itemId); |
| | | MmPredictItemEntity predictItem = mmPredictItemService.getById(itemId); |
| | | if (predictItem == null) { |
| | | log.info("itemId=" + itemId + "; is null"); |
| | | continue; |
| | | } |
| | | try { |
| | | viewDto.setItemId(itemId); |
| | | viewDto.setItemName(predictItem.getItemname()); |
| | | viewDto.setRealData(mmPredictItemService.getHisData(itemId, startTime, endTime)); |
| | | // viewDto.setPreDataN(mmItemResultService.getData(mmItemOutput.getId(), startTime, endTime)); |
| | | // viewDto.setPreDataL(mmItemResultLastPointService.getData(mmItemOutput.getId(), startTime, endTime)); |
| | | // viewDto.setCurData(mmItemResultJsonService.getData(mmItemOutput.getId(), predictTime)); |
| | | // viewDto.setAdjData(scheduleAdjustResultService.getData(itemId, predictTime)); |
| | | legends.add(predictItem.getItemname()); |
| | | List<Double> values = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(viewDto.getRealData())) { |
| | | List<Double> hisValues = new ArrayList<>(); |
| | | viewDto.getRealData().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | hisValues.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | viewDto.setHisMax(BigDecimal.valueOf(hisValues.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, RoundingMode.HALF_UP)); |
| | | viewDto.setHisMin(BigDecimal.valueOf(hisValues.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, RoundingMode.HALF_UP)); |
| | | viewDto.setHisAvg(BigDecimal.valueOf(hisValues.stream().mapToDouble(Double::doubleValue).average().getAsDouble()).setScale(2, RoundingMode.HALF_UP)); |
| | | viewDto.setHisCumulant(new BigDecimal(hisValues.stream().mapToDouble(Double::doubleValue).sum()) |
| | | .divide(new BigDecimal(HOUR_MINS), 2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(viewDto.getPreDataN())) { |
| | | viewDto.getPreDataN().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | } |
| | | if (!CollectionUtils.isEmpty(viewDto.getPreDataL())) { |
| | | List<Double> preValues = new ArrayList<>(); |
| | | viewDto.getPreDataL().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | preValues.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | viewDto.setPreMax(BigDecimal.valueOf(preValues.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, RoundingMode.HALF_UP)); |
| | | viewDto.setPreMin(BigDecimal.valueOf(preValues.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, RoundingMode.HALF_UP)); |
| | | viewDto.setPreAvg(BigDecimal.valueOf(preValues.stream().mapToDouble(Double::doubleValue).average().getAsDouble()).setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(viewDto.getCurData())) { |
| | | List<Double> preValues = new ArrayList<>(); |
| | | viewDto.getCurData().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | preValues.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | viewDto.setPreCumulant(BigDecimal.valueOf(preValues.stream().mapToDouble(Double::doubleValue).sum()) |
| | | .divide(new BigDecimal(HOUR_MINS), 2, RoundingMode.HALF_UP)); |
| | | } |
| | | if (!CollectionUtils.isEmpty(viewDto.getAdjData())) { |
| | | viewDto.getAdjData().forEach(item -> { |
| | | values.add(Double.parseDouble(item[1].toString())); |
| | | }); |
| | | } |
| | | if (!CollectionUtils.isEmpty(values)) { |
| | | viewDto.setMaxValue(BigDecimal.valueOf(values.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, RoundingMode.HALF_UP)); |
| | | viewDto.setMinValue(BigDecimal.valueOf(values.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, RoundingMode.HALF_UP)); |
| | | } |
| | | |
| | | dataViewList.add(viewDto); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | } |
| | | result.setStartTime(startTime); |
| | | result.setEndTime(endTime); |
| | | result.setPredictTime(predictTime); |
| | | result.setCategories(DateUtils.getTimeScale(startTime, endTime, 60)); |
| | | result.setLegend(legends); |
| | | result.setDataViewList(dataViewList); |
| | | return success(result); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | 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.MmItemResultJsonEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月14日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface MmItemResultJsonDao extends BaseMapperX<MmItemResultJsonEntity> { |
| | | } |
对比新文件 |
| | |
| | | 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.MmItemResultLastPointEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月14日 |
| | | */ |
| | | @TenantDS |
| | | @Mapper |
| | | public interface MmItemResultLastPointDao extends BaseMapperX<MmItemResultLastPointEntity> { |
| | | } |
| | |
| | | |
| | | private DmModuleItemEntity dmModuleItem; |
| | | |
| | | private MmItemOutputEntity mmItemOutput; |
| | | private List<MmItemOutputEntity> mmItemOutputList; |
| | | |
| | | private MmPredictModelEntity mmPredictModel; |
| | | |
| | |
| | | private String resulttableid; |
| | | |
| | | /** |
| | | * 结果 |
| | | */ |
| | | @NotBlank(message="结果不能为空") |
| | | private String resultstr; |
| | | |
| | | /** |
| | | * 结果类型 |
| | | */ |
| | | private Integer resultType; |
| | | |
| | | /** |
| | | * 结果索引 |
| | | */ |
| | | private Integer resultIndex; |
| | | |
| | | /** |
| | | * 数据点名称 |
| | | */ |
| | | @NotBlank(message="数据点名称不能为空") |
| | |
| | | * 排序(默认值1) |
| | | */ |
| | | private BigDecimal outputorder; |
| | | |
| | | /** |
| | | * 结果名称 |
| | | */ |
| | | private String resultName; |
| | | } |
| | |
| | | @Data |
| | | @TableName("T_MM_ITEM_RESULT") |
| | | public class MmItemResultEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | |
| | | * @createTime 2024年09月02日 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_ITEM_RESULT") |
| | | @TableName("t_mm_item_result_json") |
| | | public class MmItemResultJsonEntity implements Serializable { |
| | | |
| | | @TableId(value = "id",type = IdType.INPUT) |
对比新文件 |
| | |
| | | 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.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月14日 |
| | | */ |
| | | @Data |
| | | @TableName("t_mm_item_result_last_point") |
| | | public class MmItemResultLastPointEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 输出ID |
| | | */ |
| | | private String outputid; |
| | | |
| | | /** |
| | | * 预测时间 |
| | | */ |
| | | private Date datatime; |
| | | |
| | | /** |
| | | * 预测值 |
| | | */ |
| | | private BigDecimal datavalue; |
| | | } |
| | |
| | | private Integer status; |
| | | |
| | | /** |
| | | * isfuse |
| | | * 是否融合 |
| | | */ |
| | | private Integer isfuse; |
| | | |
| | |
| | | private Integer workchecked; |
| | | |
| | | /** |
| | | * unittransfactor |
| | | * 单位转换 |
| | | */ |
| | | private Integer unittransfactor; |
| | | |
| | |
| | | private String modelparamstructure; |
| | | |
| | | /** |
| | | * 结果 |
| | | */ |
| | | @NotBlank(message="结果不能为空") |
| | | private String resultstrid; |
| | | |
| | | /** |
| | | * 模型设置 |
| | | */ |
| | | private String settingmap; |
| | |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.DmModulePageReqVO; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | DmModuleEntity info(String id); |
| | | |
| | | DmModuleEntity getModuleByItemId(String itemId); |
| | | |
| | | void updatePredictTime(String id, Date predictTime); |
| | | } |
| | |
| | | */ |
| | | public interface MmItemOutputService{ |
| | | |
| | | void saveMmItemOutput(MmItemOutputEntity mmItemOutput); |
| | | void saveMmItemOutput(List<MmItemOutputEntity> mmItemOutput); |
| | | |
| | | void update(MmItemOutputEntity mmItemOutput); |
| | | |
| | |
| | | |
| | | List<MmItemOutputVO> getOutPutByPointId(String pointid); |
| | | |
| | | MmItemOutputEntity getByItemid(String itemid); |
| | | List<MmItemOutputEntity> getByItemid(String itemid); |
| | | |
| | | MmItemOutputEntity getByItemid(String itemid, String resultstr); |
| | | |
| | | void deleteByItemId(String itemId); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultJsonEntity; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月14日 |
| | | */ |
| | | public interface MmItemResultJsonService extends BaseService<MmItemResultJsonEntity> { |
| | | |
| | | List<Object[]> getData(String outputId, Date predictTime); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultLastPointEntity; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月14日 |
| | | */ |
| | | public interface MmItemResultLastPointService extends BaseService<MmItemResultLastPointEntity> { |
| | | |
| | | List<Object[]> getData(String outputid, Date startTime, Date endTime); |
| | | } |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.module.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultEntity; |
| | | import com.iailab.module.model.mdk.vo.DataValueVO; |
| | | |
| | |
| | | void savePredictValue(Map<String, List<DataValueVO>> predictValueMap, int t, String nIndex, Date predictTime); |
| | | |
| | | List<DataValueVO> getPredictValue(String outputid, Date startTime, Date endTime); |
| | | |
| | | List<Object[]> getData(String outputid, Date startTime, Date endTime); |
| | | } |
| | |
| | | List<MmPredictItemRespVO> list(Map<String, Object> params); |
| | | |
| | | MmPredictItemEntity getById(String id); |
| | | |
| | | List<Object[]> getHisData(String itemId, Date startTime, Date endTime); |
| | | } |
| | |
| | | params.put("moduletype", moduletype); |
| | | QueryWrapper<DmModuleEntity> wrapper = getWrapper(params); |
| | | return dmModuleDao.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void updatePredictTime(String id, Date predictTime) { |
| | | DmModuleEntity entity = dmModuleDao.selectById(id); |
| | | if (entity == null) { |
| | | return; |
| | | } |
| | | entity.setPredicttime(predictTime); |
| | | dmModuleDao.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | |
| | | private MmItemOutputDao mmItemOutputDao; |
| | | |
| | | @Override |
| | | public void saveMmItemOutput(MmItemOutputEntity mmItemOutput) { |
| | | mmItemOutput.setId(UUID.randomUUID().toString()); |
| | | public void saveMmItemOutput(List<MmItemOutputEntity> mmItemOutput) { |
| | | mmItemOutputDao.insert(mmItemOutput); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public MmItemOutputEntity getByItemid(String itemid) { |
| | | QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("itemid", itemid); |
| | | public List<MmItemOutputEntity> getByItemid(String itemid) { |
| | | QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("itemid", itemid).orderByAsc("outputorder"); |
| | | List<MmItemOutputEntity> list = mmItemOutputDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new MmItemOutputEntity(); |
| | | } |
| | | return list.get(0); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public MmItemOutputEntity getByItemid(String itemid, String resultstr) { |
| | | QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("itemid", itemid).eq("resultstr", resultstr); |
| | | return mmItemOutputDao.selectOne(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByItemId(String itemId) { |
| | | QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("itemid", itemId); |
| | | mmItemOutputDao.delete(queryWrapper); |
| | | } |
| | | |
| | | @Override |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.pre.dao.MmItemResultJsonDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultJsonEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemResultJsonService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月14日 |
| | | */ |
| | | @Service |
| | | public class MmItemResultJsonServiceImpl extends BaseServiceImpl<MmItemResultJsonDao, MmItemResultJsonEntity> |
| | | implements MmItemResultJsonService { |
| | | |
| | | @Override |
| | | public List<Object[]> getData(String outputId, Date predictTime) { |
| | | List<Object[]> result = new ArrayList<>(); |
| | | QueryWrapper<MmItemResultJsonEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("outputid", outputId) |
| | | .eq("predicttime", predictTime); |
| | | MmItemResultJsonEntity data = baseDao.selectOne(wrapper); |
| | | if (data == null || StringUtils.isBlank(data.getJsonvalue())) { |
| | | return result; |
| | | } |
| | | result = JSONArray.parseArray(data.getJsonvalue(), Object[].class); |
| | | result.forEach(item -> { |
| | | item[0] = new Date(Long.parseLong(item[0].toString())); |
| | | }); |
| | | return result; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.model.mcs.pre.dao.MmItemResultLastPointDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultLastPointEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemResultLastPointService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年11月14日 |
| | | */ |
| | | @Service |
| | | public class MmItemResultLastPointServiceImpl extends BaseServiceImpl<MmItemResultLastPointDao, MmItemResultLastPointEntity> |
| | | implements MmItemResultLastPointService { |
| | | |
| | | @Override |
| | | public List<Object[]> getData(String outputid, Date startTime, Date endTime) { |
| | | List<Object[]> result = new ArrayList<>(); |
| | | QueryWrapper<MmItemResultLastPointEntity> queryWrapper = new QueryWrapper<MmItemResultLastPointEntity>() |
| | | .eq("outputid", outputid) |
| | | .between("datatime", startTime, endTime) |
| | | .orderByAsc("datatime"); |
| | | List<MmItemResultLastPointEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return result; |
| | | } |
| | | list.forEach(item -> { |
| | | Object[] dataItem = new Object[2]; |
| | | dataItem[0] = DateUtils.format(item.getDatatime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | dataItem[1] = item.getDatavalue(); |
| | | result.add(dataItem); |
| | | }); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.util.date.DateUtils; |
| | | import com.iailab.module.model.mcs.pre.dao.MmItemResultDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultJsonEntity; |
| | |
| | | public void savePredictValue(Map<String, List<DataValueVO>> predictValueMap, int t, String nIndex, Date predictTime) { |
| | | List<MmItemResultEntity> importList = new ArrayList<>(); |
| | | List<MmItemResultEntity> lastList = new ArrayList<>(); |
| | | |
| | | for (Map.Entry<String, List<DataValueVO>> entry : predictValueMap.entrySet()) { |
| | | for (DataValueVO dataVo : entry.getValue()) { |
| | | MmItemResultEntity importData = new MmItemResultEntity(); |
| | |
| | | |
| | | List<DataValueVO> lastVoList = new ArrayList<>(); |
| | | int size = entry.getValue().size(); |
| | | t = t > 0 ? t : 0; |
| | | t = Math.max(t, 0); |
| | | int n = "n".equals(nIndex) ? size : Integer.parseInt(nIndex); |
| | | int length = (n - t) > 0 ? (n - t) : 0; //预测完不变的数据长度 |
| | | int length = Math.max((n - t), 0); //预测完不变的数据长度 |
| | | if (size >= n) { |
| | | for (int i = 0; i < (size - length); i ++) { |
| | | int index = length + i; |
| | |
| | | map4.put("TABLENAME", "T_MM_ITEM_RESULT_JSON"); |
| | | map4.put("entity", resultJson); |
| | | mmItemResultDao.savePredictJsonValue(map4); |
| | | } |
| | | |
| | | Map<String, Object> params = new HashMap(4); |
| | | params.put("TABLENAME", T_MM_ITEM_RESULT); |
| | | params.put("OUTPUTID", importList.get(0).getOutputid()); |
| | | params.put("STARTTIME", importList.get(0).getDatatime()); |
| | | params.put("ENDTIME", importList.get(importList.size() - 1).getDatatime()); |
| | | mmItemResultDao.deletePredictValue(params); |
| | | |
| | | int num1 = importList.size() / max_group_count; |
| | | int num2 = importList.size() % max_group_count; |
| | | if (num2 != 0) { |
| | | num1++; |
| | | Map<String, Object> params = new HashMap(4); |
| | | params.put("TABLENAME", T_MM_ITEM_RESULT); |
| | | params.put("OUTPUTID", entry.getKey()); |
| | | params.put("STARTTIME", importList.get(0).getDatatime()); |
| | | params.put("ENDTIME", importList.get(importList.size() - 1).getDatatime()); |
| | | mmItemResultDao.deletePredictValue(params); |
| | | } |
| | | |
| | | List<MmItemResultEntity> tempList; |
| | | //先删除已经存在的数据,再插入新数据 |
| | | for (int i = 0; i < num1; i++) { |
| | | int startIndex = max_group_count * i; |
| | | int count = max_group_count; |
| | | if (num2!=0 && i == num1 - 1) { |
| | | count = num2; |
| | | } |
| | | tempList = new ArrayList<>(); |
| | | //获取某个索引范围内的对象集合 |
| | | for (int j = startIndex; j < startIndex + count; j++) { |
| | | tempList.add(importList.get(j)); |
| | | } |
| | | Map<String, Object> map2 = new HashMap<>(2); |
| | | map2.put("TABLENAME", T_MM_ITEM_RESULT); |
| | | map2.put("list", tempList); |
| | | mmItemResultDao.savePredictValue(map2); |
| | | } |
| | | mmItemResultDao.insertBatch(importList,max_group_count); |
| | | |
| | | Map<String, Object> map3 = new HashMap<>(2); |
| | | map3.put("TABLENAME", "T_MM_ITEM_RESULT_LAST_POINT"); |
| | |
| | | }).collect(Collectors.toList()); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<Object[]> getData(String outputid, Date startTime, Date endTime) { |
| | | List<Object[]> result = new ArrayList<>(); |
| | | QueryWrapper<MmItemResultEntity> queryWrapper = new QueryWrapper<MmItemResultEntity>() |
| | | .eq("outputid", outputid) |
| | | .between("datatime", startTime, endTime) |
| | | .orderByAsc("datatime"); |
| | | List<MmItemResultEntity> list = mmItemResultDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return result; |
| | | } |
| | | list.forEach(item -> { |
| | | Object[] dataItem = new Object[2]; |
| | | dataItem[0] = DateUtils.format(item.getDatatime(), DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | dataItem[1] = item.getDatavalue(); |
| | | result.add(dataItem); |
| | | }); |
| | | return result; |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.model.mcs.pre.dao.MmPredictItemDao; |
| | | import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO; |
| | | import com.iailab.module.model.mcs.pre.entity.*; |
| | |
| | | @Autowired |
| | | private MmPredictItemDao mmPredictItemDao; |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | @Override |
| | | public PageResult<MmPredictItemRespVO> queryPage(MmPredictItemPageReqVO reqVO) { |
| | | IPage<MmPredictItemRespVO> page = mmPredictItemDao.selectPage(reqVO); |
| | | |
| | | return new PageResult<MmPredictItemRespVO>(page.getRecords(), page.getTotal()); |
| | | return new PageResult<>(page.getRecords(), page.getTotal()); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public MmPredictItemEntity getById(String id) { |
| | | return mmPredictItemDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<Object[]> getHisData(String itemId, Date startTime, Date endTime) { |
| | | List<Object[]> result = new ArrayList<>(); |
| | | return result; |
| | | } |
| | | |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | |
| | | dmModuleItem.setItemid(predictItem.getId()); |
| | | dmModuleItemService.saveModuleItem(dmModuleItem); |
| | | |
| | | MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput(); |
| | | mmItemOutput.setItemid(predictItem.getId()); |
| | | List<MmItemOutputEntity> mmItemOutput = mmPredictItemDto.getMmItemOutputList(); |
| | | mmItemOutput.forEach(e -> { |
| | | e.setId(UUID.randomUUID().toString()); |
| | | e.setItemid(predictItem.getId()); |
| | | }); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | } |
| | | |
| | |
| | | if (!"".equals(dmModuleItem.getId()) && dmModuleItem.getId() != null) { |
| | | dmModuleItemService.update(dmModuleItem); |
| | | } |
| | | MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput(); |
| | | if (!"".equals(mmItemOutput.getId()) && dmModuleItem.getId() != null) { |
| | | mmItemOutputService.update(mmItemOutput); |
| | | } |
| | | mmItemOutputService.deleteByItemId(predictItem.getId()); |
| | | List<MmItemOutputEntity> mmItemOutput = mmPredictItemDto.getMmItemOutputList(); |
| | | mmItemOutput.forEach(e -> { |
| | | e.setId(UUID.randomUUID().toString()); |
| | | e.setItemid(predictItem.getId()); |
| | | }); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | } |
| | | |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | |
| | | MmPredictItemDTO mmPredictItemDto = BeanUtils.toBean(predictItem, MmPredictItemDTO.class); |
| | | mmPredictItemDto.setMmPredictItem(predictItem); |
| | | mmPredictItemDto.setDmModuleItem(dmModuleItemService.getByItemid(id)); |
| | | mmPredictItemDto.setMmItemOutput(mmItemOutputService.getByItemid(id)); |
| | | mmPredictItemDto.setMmItemOutputList(mmItemOutputService.getByItemid(id)); |
| | | MmItemTypeEntity itemType = mmItemTypeImpl.getById(predictItem.getItemtypeid()); |
| | | if (itemType != null && ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | MmPredictModelEntity mmPredictModel = mmPredictModelService.getByItemid(id); |
| | |
| | | mmPredictItemDto.setMmModelParamList(mmModelParamService.getByModelid(mmPredictModel.getId())); |
| | | mmPredictItemDto.setMmPredictMergeItem(new MmPredictMergeItemEntity()); |
| | | } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | mmPredictItemDto.setMmPredictModel(new MmPredictModelEntity()); |
| | | mmPredictItemDto.setMmModelArithSettingsList(new ArrayList<>()); |
| | | mmPredictItemDto.setMmModelParamList(new ArrayList<>()); |
| | | mmPredictItemDto.setMmPredictMergeItem(new MmPredictMergeItemEntity()); |
| | | mmPredictItemDto.setMmPredictMergeItem(mmPredictMergeItemService.getByItemid(id)); |
| | | } |
| | | return mmPredictItemDto; |
| | |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.iailab.module.model.mcs.pre.entity.*; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @ExcelProperty("存放表") |
| | | private String tablename; |
| | | |
| | | @Schema(description = "运行时间") |
| | | @ExcelProperty("运行时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date lastTime; |
| | | |
| | | @Schema(description = "运行状态") |
| | | @ExcelProperty("运行状态") |
| | | private Integer runStatus; |
| | | |
| | | @Schema(description = "运行耗时") |
| | | @ExcelProperty("运行耗时") |
| | | private Long duration; |
| | | |
| | | } |
| | | |
| | |
| | | */ |
| | | public interface PredictItemHandler { |
| | | |
| | | /** |
| | | * 单个预测项预测 |
| | | * |
| | | * @param predictTime |
| | | * @param predictItemDto |
| | | * @return |
| | | * @throws ItemInvokeException |
| | | */ |
| | | PredictResultVO predict(Date predictTime, ItemVO predictItemDto) throws ItemInvokeException; |
| | | } |
| | |
| | | */ |
| | | public interface PredictModelHandler { |
| | | |
| | | /** |
| | | * 根据模型预测 |
| | | * |
| | | * @param predictTime |
| | | * @param predictModel |
| | | * @return |
| | | * @throws ModelInvokeException |
| | | */ |
| | | PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel) throws ModelInvokeException; |
| | | } |
| | |
| | | package com.iailab.module.model.mdk.predict; |
| | | |
| | | import com.iailab.module.model.mcs.pre.enums.ItemRunStatusEnum; |
| | | import com.iailab.module.model.mcs.pre.enums.ItemStatus; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemStatusService; |
| | | import com.iailab.module.model.mdk.factory.PredictItemFactory; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | |
| | | @Autowired |
| | | private PredictResultHandler predictResultHandler; |
| | | |
| | | @Autowired |
| | | private MmItemStatusService mmItemStatusService; |
| | | |
| | | |
| | | /** |
| | | * 预测处理 |
| | | * |
| | | * @param predictItemList |
| | | * @param predictTime |
| | | * @param intervalTime |
| | | * @return |
| | | */ |
| | | public Map<String, PredictResultVO> predict(List<ItemVO> predictItemList, Date predictTime, int intervalTime) { |
| | | Map<String, PredictResultVO> result = new HashMap<>(); |
| | | |
| | |
| | | if (!predictItem.getStatus().equals(ItemStatus.STATUS1.getCode())) { |
| | | continue; |
| | | } |
| | | Long totalDur = 0L; |
| | | try { |
| | | mmItemStatusService.recordStatus(predictItem.getId(), ItemRunStatusEnum.PROCESSING, totalDur); |
| | | PredictItemHandler predictItemHandler = predictItemFactory.create(predictItem.getId()); |
| | | Instant start = Instant.now(); |
| | | try { |
| | | // 预测项开始预测 |
| | | predictResult = predictItemHandler.predict(predictTime, predictItem); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | Instant end = Instant.now(); |
| | | Long drtPre = Duration.between(start, end).getSeconds(); |
| | | log.info(MessageFormat.format("预测项:{0},预测时间:{1}秒", predictItem.getItemName(), drtPre)); |
| | | totalDur = totalDur + drtPre; |
| | | |
| | | predictResult.setGranularity(predictItem.getGranularity()); |
| | | predictResult.setT(intervalTime); |
| | | predictResult.setSaveIndex(predictItem.getSaveIndex()); |
| | | predictResult.setLt(1); |
| | | |
| | | // 保存预测结果 |
| | | predictResultHandler.savePredictResult(predictResult); |
| | | Instant endSave = Instant.now(); |
| | | Long drtSave = Duration.between(end, endSave).getSeconds(); |
| | | log.info(MessageFormat.format("预测项:{0},保存时间:{1}秒", predictItem.getItemName(), |
| | | drtSave)); |
| | | |
| | | totalDur = totalDur + drtSave; |
| | | mmItemStatusService.recordStatus(predictItem.getId(), ItemRunStatusEnum.SUCCESS, totalDur); |
| | | result.put(predictItem.getItemNo(), predictResult); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error(MessageFormat.format("预测项编号:{0},预测项名称:{1},预测失败:{2} 预测时刻:{3}", |
| | | predictItem.getId(), predictItem.getItemName(), e.getMessage(), predictTime)); |
| | | mmItemStatusService.recordStatus(predictItem.getId(), ItemRunStatusEnum.FAIL, totalDur); |
| | | } |
| | | } |
| | | return result; |
| | |
| | | package com.iailab.module.model.mdk.predict; |
| | | |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.data.enums.DataPointFreq; |
| | | import com.baomidou.dynamic.datasource.annotation.DSTransactional; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemResultService; |
| | | import com.iailab.module.model.mdk.factory.ItemEntityFactory; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import com.iailab.module.model.mdk.vo.DataValueVO; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | /** |
| | | * convertToPredictData |
| | | * |
| | |
| | | resultMap.put(itemOutPutList.get(0).getId(), predictResult.getPredictList()); |
| | | return resultMap; |
| | | } |
| | | ApiPointDTO point = dataPointApi.getInfoById(itemOutPutList.get(0).getPointId()); |
| | | List<Date> dateTimeList = new ArrayList<>(); |
| | | Integer rows = predictResult.getPredictMatrix().length; |
| | | Integer columns = predictResult.getPredictMatrix()[0].length; |
| | | Date tempTime = predictResult.getPredictTime(); |
| | | for (Integer i = 0; i < rows; i++) { |
| | | dateTimeList.add(tempTime); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(tempTime); |
| | | calendar.add(Calendar.SECOND, DataPointFreq.getEumByCode(point.getMinfreqid()).getValue()); |
| | | tempTime = calendar.getTime(); |
| | | } |
| | | for (Integer i = 0; i < columns; i++) { |
| | | Map<MmItemOutputEntity, double[]> predictMatrixs = predictResult.getPredictMatrixs(); |
| | | HashMap<String,List<DataValueVO>> predictLists = new HashMap<>(); |
| | | for (Map.Entry<MmItemOutputEntity, double[]> entry : predictMatrixs.entrySet()) { |
| | | Integer rows = entry.getValue().length; |
| | | List<DataValueVO> predictDataList = new ArrayList<>(); |
| | | for (Integer j = 0; j < rows; j++) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictResult.getPredictTime()); |
| | | for (Integer i = 0; i < rows; i++) { |
| | | DataValueVO predictData = new DataValueVO(); |
| | | predictData.setDataTime(dateTimeList.get(j)); |
| | | predictData.setDataValue(Double.valueOf(predictResult.getPredictMatrix()[j][i])); |
| | | predictData.setDataTime(calendar.getTime()); |
| | | predictData.setDataValue(Double.valueOf(entry.getValue()[i])); |
| | | predictDataList.add(predictData); |
| | | |
| | | calendar.add(Calendar.SECOND, predictResult.getGranularity()); |
| | | } |
| | | resultMap.put(itemOutPutList.get(i).getId(), predictDataList); |
| | | predictResult.setPredictList(predictDataList); |
| | | resultMap.put(entry.getKey().getId(), predictDataList); |
| | | predictLists.put(entry.getKey().getResultstr(), predictDataList); |
| | | } |
| | | predictResult.setPredictLists(predictLists); |
| | | return resultMap; |
| | | } |
| | | |
| | | public Map<String, List<DataValueVO>> convertToPredictData2(PredictResultVO predictResult) { |
| | | Map<String, List<DataValueVO>> predictLists = new HashMap<>(); |
| | | if (!CollectionUtils.isEmpty(predictResult.getPredictList())) { |
| | | return predictLists; |
| | | } |
| | | Map<MmItemOutputEntity, double[]> predictMatrixs = predictResult.getPredictMatrixs(); |
| | | for (Map.Entry<MmItemOutputEntity, double[]> entry : predictMatrixs.entrySet()) { |
| | | Integer rows = entry.getValue().length; |
| | | List<DataValueVO> predictDataList = new ArrayList<>(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictResult.getPredictTime()); |
| | | for (Integer i = 0; i < rows; i++) { |
| | | DataValueVO predictData = new DataValueVO(); |
| | | predictData.setDataTime(calendar.getTime()); |
| | | predictData.setDataValue(Double.valueOf(entry.getValue()[i])); |
| | | predictDataList.add(predictData); |
| | | |
| | | calendar.add(Calendar.SECOND, predictResult.getGranularity()); |
| | | } |
| | | predictLists.put(entry.getKey().getResultstr(), predictDataList); |
| | | } |
| | | return predictLists; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param predictResult |
| | | */ |
| | | @Async |
| | | @DSTransactional |
| | | public void savePredictResult(PredictResultVO predictResult) { |
| | | Map<String, List<DataValueVO>> resultMap = convertToPredictData(predictResult); |
| | | mmItemResultService.savePredictValue(resultMap, predictResult.getLt(), "n", predictResult.getPredictTime()); |
| | |
| | | |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.data.enums.DataPointFreq; |
| | | import com.iailab.module.data.enums.DataPointFreqEnum; |
| | | import com.iailab.module.model.mdk.common.enums.ItemPredictStatus; |
| | | import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException; |
| | | import com.iailab.module.model.mdk.factory.ItemEntityFactory; |
| | |
| | | @Autowired |
| | | private PredictResultHandler predictResultHandler; |
| | | |
| | | /** |
| | | * MergeItem预测 |
| | | * |
| | | * @param predictTime |
| | | * @param predictItemDto |
| | | * @return |
| | | * @throws ItemInvokeException |
| | | */ |
| | | @Override |
| | | public PredictResultVO predict(Date predictTime, ItemVO predictItemDto) |
| | | throws ItemInvokeException { |
| | |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(endTime); |
| | | calendar.add(Calendar.SECOND, (predictLength - 1) * DataPointFreq.getEumByCode(pointEntity.getMinfreqid()).getValue()); |
| | | calendar.add(Calendar.SECOND, (predictLength - 1) * DataPointFreqEnum.getEumByCode(pointEntity.getMinfreqid()).getValue()); |
| | | endTime = new Timestamp(calendar.getTime().getTime()); |
| | | List<DataValueVO> predictValueList = predictResultHandler.getPredictValueByItemNo(itemNo, predictTime, endTime); |
| | | if (predictValueList.size() != predictLength) { |
| | |
| | | @Autowired |
| | | private PredictModelHandler predictModelHandler; |
| | | |
| | | /** |
| | | * NormalItem预测 |
| | | * |
| | | * @param predictTime |
| | | * @param predictItemDto |
| | | * @return |
| | | * @throws ItemInvokeException |
| | | */ |
| | | @Override |
| | | public PredictResultVO predict(Date predictTime, ItemVO predictItemDto) |
| | | throws ItemInvokeException{ |
| | | String itemId = predictItemDto.getId(); |
| | | ItemPredictStatus itemStatus = ItemPredictStatus.PREDICTING; |
| | | PredictResultVO finalResult = new PredictResultVO(); |
| | | PredictResultVO predictResult = new PredictResultVO(); |
| | | List<PredictResultVO> predictResultList = new ArrayList<>(); |
| | | String itemId = predictItemDto.getId(); |
| | | predictResult.setPredictId(itemId); |
| | | try { |
| | | // 获取预测项模型 |
| | | List<MmPredictModelEntity> predictModelList = mmPredictModelService.getActiveModelByItemId(itemId); |
| | |
| | | throw new ModelInvokeException(MessageFormat.format("{0},itemId={1}", |
| | | ModelInvokeException.errorGetModelEntity, itemId)); |
| | | } |
| | | for (MmPredictModelEntity predictModel : predictModelList) { |
| | | predictResult = predictModelHandler.predictByModel(predictTime, predictModel); |
| | | predictResult.setPredictId(itemId); |
| | | predictResultList.add(predictResult); |
| | | } |
| | | itemStatus = ItemPredictStatus.SUCCESS; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(predictTime); |
| | | calendar.add(Calendar.MINUTE, predictResult.getPredictMatrix().length - 1); |
| | | Timestamp endTime = new Timestamp(calendar.getTime().getTime()); |
| | | finalResult = predictResultList.get(0); |
| | | |
| | | MmPredictModelEntity predictModel = predictModelList.get(0); |
| | | predictResult = predictModelHandler.predictByModel(predictTime, predictModel); |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | //预测项预测失败的状态 |
| | | itemStatus = ItemPredictStatus.FAILED; |
| | | throw new ItemInvokeException(MessageFormat.format("{0},itemId={1}", |
| | | ItemInvokeException.errorItemFailed, itemId)); |
| | | } |
| | | |
| | | return finalResult; |
| | | return predictResult; |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iail.IAILMDK; |
| | | import com.iail.model.IAILModel; |
| | | import com.iailab.module.model.common.enums.CommonConstant; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelResultstrEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelResultstrService; |
| | | import com.iailab.module.model.mdk.common.enums.TypeA; |
| | | import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException; |
| | | import com.iailab.module.model.mdk.predict.PredictModelHandler; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | |
| | | private MmModelArithSettingsService mmModelArithSettingsService; |
| | | |
| | | @Autowired |
| | | private MmModelResultstrService mmModelResultstrService; |
| | | private MmItemOutputService mmItemOutputService; |
| | | |
| | | @Autowired |
| | | private SampleConstructor sampleConstructor; |
| | | |
| | | /** |
| | | * 根据模型预测,返回预测结果 |
| | | * |
| | | * @param predictTime |
| | | * @param predictModel |
| | | * @return |
| | | * @throws ModelInvokeException |
| | | */ |
| | | @Override |
| | | public PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel) throws ModelInvokeException { |
| | | public synchronized PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel) throws ModelInvokeException { |
| | | PredictResultVO result = new PredictResultVO(); |
| | | if (predictModel == null) { |
| | | throw new ModelInvokeException("modelEntity is null"); |
| | |
| | | int portLength = sampleDataList.size(); |
| | | Object[] param2Values = new Object[portLength + 2]; |
| | | for (int i = 0; i < portLength; i++) { |
| | | param2Values[i]=sampleDataList.get(i).getMatrix(); |
| | | param2Values[i] = sampleDataList.get(i).getMatrix(); |
| | | } |
| | | param2Values[portLength] = newModelBean.getDataMap().get("models"); |
| | | param2Values[portLength+1] = settings; |
| | | param2Values[portLength + 1] = settings; |
| | | |
| | | log.info("#######################预测模型 " + predictModel.getItemid() + " ##########################"); |
| | | JSONObject jsonObjNewModelBean = new JSONObject(); |
| | |
| | | log.info(String.valueOf(jsonObjParam2Values)); |
| | | |
| | | //IAILMDK.run |
| | | // HashMap<String, Object> modelResult = IAILMDK.run(newModelBean, param2Values); |
| | | HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, predictModel.getMpkprojectid()); |
| | | if (!modelResult.containsKey(CommonConstant.MDK_STATUS_CODE) || !modelResult.containsKey(CommonConstant.MDK_RESULT) || |
| | | !modelResult.get(CommonConstant.MDK_STATUS_CODE).toString().equals(CommonConstant.MDK_STATUS_100)) { |
| | | throw new RuntimeException("模型结果异常:" + modelResult); |
| | | } |
| | | modelResult = (HashMap<String, Object>) modelResult.get(CommonConstant.MDK_RESULT); |
| | | //打印结果 |
| | | JSONObject jsonObjResult = new JSONObject(); |
| | | jsonObjResult.put("result", modelResult); |
| | | log.info(String.valueOf(jsonObjResult)); |
| | | |
| | | MmModelResultstrEntity modelResultstr = mmModelResultstrService.getInfo(predictModel.getResultstrid()); |
| | | log.info("模型计算完成:modelId=" + modelId + result); |
| | | if (modelResult.containsKey(modelResultstr.getResultstr())) { |
| | | Double[][] temp = (Double[][]) modelResult.get(modelResultstr.getResultstr()); |
| | | double[][] temp1 = new double[temp.length][temp[0].length]; |
| | | for (int i = 0; i < temp.length; i++) { |
| | | for (int j = 0; j < temp[i].length; j++) { |
| | | temp1[i][j] = temp[i][j].doubleValue(); |
| | | List<MmItemOutputEntity> ItemOutputList = mmItemOutputService.getByItemid(predictModel.getItemid()); |
| | | log.info("模型计算完成:modelId=" + modelId + modelResult); |
| | | |
| | | Map<MmItemOutputEntity, double[]> predictMatrixs = new HashMap<>(ItemOutputList.size()); |
| | | |
| | | for (MmItemOutputEntity outputEntity : ItemOutputList) { |
| | | String resultStr = outputEntity.getResultstr(); |
| | | if (modelResult.containsKey(resultStr)) { |
| | | if (outputEntity.getResultType() == 1) { |
| | | // 一维数组 |
| | | Double[] temp = (Double[]) modelResult.get(resultStr); |
| | | double[] temp1 = new double[temp.length]; |
| | | for (int i = 0; i < temp.length; i++) { |
| | | temp1[i] = temp[i].doubleValue(); |
| | | } |
| | | predictMatrixs.put(outputEntity, temp1); |
| | | } else if (outputEntity.getResultType() == 2) { |
| | | // 二维数组 |
| | | Double[][] temp = (Double[][]) modelResult.get(resultStr); |
| | | Double[] temp2 = temp[outputEntity.getResultIndex()]; |
| | | double[] temp1 = new double[temp2.length]; |
| | | for (int i = 0; i < temp2.length; i++) { |
| | | temp1[i] = temp2[i].doubleValue(); |
| | | } |
| | | predictMatrixs.put(outputEntity, temp1); |
| | | } |
| | | } |
| | | result.setPredictMatrix(temp1); |
| | | } |
| | | result.setPredictMatrixs(predictMatrixs); |
| | | result.setModelResult(modelResult); |
| | | result.setPredictTime(predictTime); |
| | | } catch (Exception ex) { |
| | | log.error("IAILModel对象构造失败,modelId=" + modelId); |
| | | log.error("调用发生异常,异常信息为:{}", ex); |
| | | log.error(ex.getMessage()); |
| | | log.error("调用发生异常,异常信息为:{}" , ex); |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | return result; |
| | | } |
| | |
| | | newModelBean.setParamsArray(paramsArray); |
| | | HashMap<String, Object> dataMap = new HashMap<>(); |
| | | HashMap<String, String> models = new HashMap<>(1); |
| | | models.put("paramFile", predictModel.getModelpath()); |
| | | models.put("model_path", predictModel.getModelpath()); |
| | | dataMap.put("models", models); |
| | | newModelBean.setDataMap(dataMap); |
| | | return newModelBean; |
| | |
| | | } |
| | | //补全数据 |
| | | ColumnItem columnItem = entry.getColumnItemList().get(i); |
| | | dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.getEndTime(), columnItem.granularity); |
| | | // dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.getEndTime(), columnItem.granularity); |
| | | dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.endTime, columnItem.paramId,columnItem.getParamType()); |
| | | |
| | | /** 如果数据取不满,把缺失的数据点放在后面 */ |
| | | if (dataEntityList != null && dataEntityList.size() != 0) { |
| | |
| | | String paramType = columnItem.getParamType(); |
| | | switch (paramType) { |
| | | case "DATAPOINT": |
| | | ApiPointDTO point = dataPointApi.getInfoById(columnItem.getId()); |
| | | ApiPointDTO point = dataPointApi.getInfoById(columnItem.getParamId()); |
| | | ApiPointValueQueryDTO queryDto = new ApiPointValueQueryDTO(); |
| | | queryDto.setPointNo(point.getPointNo()); |
| | | queryDto.setStart(columnItem.getStartTime()); |
| | |
| | | package com.iailab.module.model.mdk.sample; |
| | | |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.data.enums.DataPointFreqEnum; |
| | | import com.iailab.module.model.mdk.common.enums.ModelParamType; |
| | | import com.iailab.module.model.mdk.sample.dto.SampleData; |
| | | import com.iailab.module.model.mdk.sample.dto.SampleInfo; |
| | | import com.iailab.module.model.mdk.vo.DataValueVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | |
| | | abstract class SampleDataConstructor { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | /** |
| | | * prepareSampleData |
| | |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | public List<DataValueVO> completionData(int length, List<DataValueVO> dataEntityList, Date startTime, Date endTime, int granularity) { |
| | | if (CollectionUtils.isEmpty(dataEntityList) || length <= dataEntityList.size()) { |
| | | public List<DataValueVO> completionData(int length, List<DataValueVO> dataEntityList, Date startTime, Date endTime, String paramId,String paramType) { |
| | | if (CollectionUtils.isEmpty(dataEntityList) || length == dataEntityList.size()) { |
| | | return dataEntityList; |
| | | }else if (length < dataEntityList.size()){ |
| | | return dataEntityList.subList(dataEntityList.size()-length,dataEntityList.size()); |
| | | } |
| | | logger.info("补全数据, length =" + length + "; size = " + dataEntityList.size() + "; startTime = " + startTime.getTime() + "; endTime = " + endTime.getTime()); |
| | | logger.info("补全前:" + dataEntityList); |
| | | |
| | | List<DataValueVO> completionDataEntityList = new ArrayList<>(); |
| | | long oneMin = 0L; |
| | | |
| | | long start = startTime.getTime(); |
| | | long end = endTime.getTime(); |
| | | long mins = 0L; |
| | | |
| | | switch (ModelParamType.getEumByCode(paramType)) { |
| | | case PREDICTITEM: |
| | | // 预测值 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(startTime); |
| | | calendar.set(Calendar.HOUR_OF_DAY,0); |
| | | calendar.set(Calendar.MINUTE,0); |
| | | calendar.set(Calendar.SECOND,0); |
| | | calendar.add(Calendar.DAY_OF_YEAR,1); |
| | | startTime = calendar.getTime(); |
| | | start = startTime.getTime(); |
| | | |
| | | calendar.setTime(endTime); |
| | | calendar.set(Calendar.HOUR_OF_DAY,0); |
| | | calendar.set(Calendar.MINUTE,0); |
| | | calendar.set(Calendar.SECOND,0); |
| | | endTime = calendar.getTime(); |
| | | end = endTime.getTime(); |
| | | |
| | | |
| | | oneMin = 24 * 60 * 60 * 1000; |
| | | mins = ((end - start) / oneMin); |
| | | break; |
| | | case DATAPOINT: |
| | | // 测点值 |
| | | ApiPointDTO dataPoint = dataPointApi.getInfoById(paramId); |
| | | oneMin = 1000L * DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue(); |
| | | |
| | | // 设置时间偏移量 |
| | | start = start - (start % oneMin) + oneMin; |
| | | end = end - (end % oneMin) + oneMin; |
| | | |
| | | |
| | | mins = ((end - start) / oneMin); |
| | | break; |
| | | case IND: |
| | | // 指标数据 |
| | | oneMin = 24 * 60 * 60 * 1000; |
| | | Calendar calendar2 = Calendar.getInstance(); |
| | | calendar2.setTime(startTime); |
| | | calendar2.set(Calendar.HOUR_OF_DAY,0); |
| | | calendar2.set(Calendar.MINUTE,0); |
| | | calendar2.set(Calendar.SECOND,0); |
| | | start = calendar2.getTime().getTime(); |
| | | |
| | | calendar2.setTime(endTime); |
| | | calendar2.set(Calendar.HOUR_OF_DAY,0); |
| | | calendar2.set(Calendar.MINUTE,0); |
| | | calendar2.set(Calendar.SECOND,0); |
| | | end = calendar2.getTime().getTime(); |
| | | |
| | | |
| | | mins = ((end - start) / oneMin); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | Map<Long, Double> sourceDataMap = new HashMap<>(dataEntityList.size()); |
| | | for (DataValueVO dataEntity : dataEntityList) { |
| | | sourceDataMap.put(dataEntity.getDataTime().getTime(), dataEntity.getDataValue()); |
| | | } |
| | | |
| | | //找出缺少项 |
| | | long oneMin = 1000 * granularity; |
| | | long start = startTime.getTime(); |
| | | long end = endTime.getTime(); |
| | | long mins = ((end - start) / oneMin) + 1; |
| | | Map<Long, Double> dataMap = new LinkedHashMap<>(); |
| | | for (int i = 0; i < mins; i++) { |
| | | for (int i = 0; i < mins; i ++) { |
| | | Long key = start + oneMin * i; |
| | | Double value = sourceDataMap.get(key); |
| | | dataMap.put(key, value); |
| | |
| | | //补充缺少项 |
| | | int k = 0; |
| | | Map.Entry<Long, Double> lastItem = null; |
| | | List<DataValueVO> completionDataEntityList = new ArrayList<>(); |
| | | for (Map.Entry<Long, Double> item : dataMap.entrySet()) { |
| | | if (k == 0 && item.getValue() == null) { |
| | | item.setValue(getFirstValue(dataMap)); |
| | | } else if (item.getValue() == null) { |
| | | item.setValue(lastItem.getValue()); |
| | | } |
| | | k++; |
| | | k ++; |
| | | lastItem = item; |
| | | |
| | | DataValueVO dataEntity = new DataValueVO(); |
| | | dataEntity.setDataTime(new Date(item.getKey())); |
| | | dataEntity.setDataTime(new Timestamp(item.getKey())); |
| | | dataEntity.setDataValue(item.getValue()); |
| | | completionDataEntityList.add(dataEntity); |
| | | } |
| | | |
| | | logger.info("补全后:" + completionDataEntityList); |
| | | return completionDataEntityList; |
| | | } |
| | | |
| | |
| | | package com.iailab.module.model.mdk.sample; |
| | | |
| | | import com.iailab.module.data.api.plan.PlanItemApi; |
| | | import com.iailab.module.data.api.plan.dto.ApiPlanItemDTO; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.data.enums.DataPointFreq; |
| | | import com.iailab.module.data.enums.DataPointFreqEnum; |
| | | import com.iailab.module.data.enums.TimeGranularityEnum; |
| | | import com.iailab.module.model.mdk.common.enums.ModelParamType; |
| | | import com.iailab.module.model.mdk.factory.ItemEntityFactory; |
| | | import com.iailab.module.model.mdk.sample.dto.ColumnItem; |
| | | import com.iailab.module.model.mdk.sample.dto.ColumnItemPort; |
| | |
| | | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | @Autowired |
| | | private PlanItemApi planItemApi; |
| | | |
| | | /** |
| | | * prepareSampleInfo |
| | |
| | | Date dateTime = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(originalTime); |
| | | switch (columnItem.getParamType()) { |
| | | case "DATAPOINT": |
| | | switch (ModelParamType.getEumByCode(columnItem.getParamType())) { |
| | | case DATAPOINT: |
| | | ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId()); |
| | | if (dataPoint == null) { |
| | | return null; |
| | | } |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), DataPointFreq.getEumByCode(dataPoint.getMinfreqid()).getValue()); |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue()); |
| | | break; |
| | | case "PREDICTITEM": |
| | | case PREDICTITEM: |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case "IND-HIS": |
| | | case IND: |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60); |
| | | break; |
| | | case "IND-PLAN": |
| | | case PLAN: |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | default: |
| | |
| | | Date dateTime = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(originalTime); |
| | | switch (columnItem.getParamType()) { |
| | | case "DATAPOINT": |
| | | switch (ModelParamType.getEumByCode(columnItem.getParamType())) { |
| | | case DATAPOINT: |
| | | ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId()); |
| | | if (dataPoint == null) { |
| | | return null; |
| | | } |
| | | calendar.add(Calendar.SECOND, DataPointFreq.getEumByCode(dataPoint.getMinfreqid()).getValue() * -1); |
| | | break; |
| | | case "PREDICTITEM": |
| | | dateTime = calculateTime(originalTime, false, columnItem.getDataLength(), 60); |
| | | break; |
| | | case "IND-HIS": |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case "IND-PLAN": |
| | | dateTime = calculateTime(originalTime, false, columnItem.getDataLength(), 60); |
| | | case PREDICTITEM: |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case IND: |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case PLAN: |
| | | ApiPlanItemDTO planItem = planItemApi.getInfoByNo(columnItem.getParamId()); |
| | | if (planItem == null) { |
| | | return null; |
| | | } |
| | | dateTime = calculateDate(originalTime, false, columnItem.getDataLength(), |
| | | TimeGranularityEnum.getEumByCode(planItem.getTimeGranularity()).getValue()); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | switch (columnItem.getParamType()) { |
| | | case "DATAPOINT": |
| | | ApiPointDTO dataPoint = dataPointApi.getInfoById(columnItem.getParamId()); |
| | | granularity = DataPointFreq.getEumByCode(dataPoint.getMinfreqid()).getValue(); |
| | | granularity = DataPointFreqEnum.getEumByCode(dataPoint.getMinfreqid()).getValue(); |
| | | break; |
| | | case "PREDICTITEM": |
| | | granularity = itemEntityFactory.getItemById(columnItem.getParamId()).getGranularity(); |
| | |
| | | calendar.add(Calendar.SECOND, timeLength * granularity); |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | public Date calculateDate(Date originalTime, Boolean backward, int dataLength, int field) { |
| | | int timeLength; |
| | | if (backward) { |
| | | timeLength = (-1) * dataLength; |
| | | } else { |
| | | timeLength = dataLength - 1; |
| | | } |
| | | Date desTime = originalTime; |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(desTime); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | // 数据长度 * 粒度 |
| | | calendar.add(Calendar.SECOND, timeLength); |
| | | return calendar.getTime(); |
| | | } |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | |
| | | * 项目id |
| | | */ |
| | | private String mpkProjectId; |
| | | |
| | | /** |
| | | * 最后运行时间 |
| | | */ |
| | | private Date lastTime; |
| | | } |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | |
| | | private double[][] predictMatrix; |
| | | |
| | | /** |
| | | * 统一预测入口的预测类型(循环调用、手动调用) Map<MmItemOutputEntity,double[]> |
| | | */ |
| | | private Map<MmItemOutputEntity, double[]> predictMatrixs; |
| | | |
| | | /** |
| | | * 时间间隔 (当前预测时间 与 上一次预测时间 相差的分钟数;系统计算得出) |
| | | */ |
| | | private int t; |
| | |
| | | private String saveIndex; |
| | | |
| | | /** |
| | | * 粒度 |
| | | */ |
| | | private Integer granularity; |
| | | |
| | | /** |
| | | * 预测集合 |
| | | */ |
| | | private List<DataValueVO> predictList; |
| | | /** |
| | | * 预测集合 |
| | | */ |
| | | private HashMap<String, List<DataValueVO>> predictLists; |
| | | |
| | | /** |
| | | * 模型结果 |
| | |
| | | dto.setGroupName(dto.getMenuAndGroup().get(1)); |
| | | } |
| | | } |
| | | dto.setPyModule(packService.getModelPath(dto.getClassName())); |
| | | dto.setPyModule(packService.getModelPath(dto.getPkgName())); |
| | | mpkFileService.save(dto); |
| | | return CommonResult.success(true); |
| | | } |
| | |
| | | dto.setGroupName(dto.getMenuAndGroup().get(1)); |
| | | } |
| | | } |
| | | dto.setPyModule(packService.getModelPath(dto.getClassName())); |
| | | dto.setPyModule(packService.getModelPath(dto.getPkgName())); |
| | | mpkFileService.update(dto); |
| | | return CommonResult.success(true); |
| | | } |
| | |
| | | - t_chart_param |
| | | - t_chart |
| | | - t_mpk_pack |
| | | - t_mm_item_status |
| | | app: |
| | | app-key: model |
| | | app-secret: 85b0df7edc3df3611913df34ed695011 |
| | |
| | | (id,outputid,datatime,datavalue) |
| | | VALUES |
| | | <foreach item="item" collection="list" separator=","> |
| | | (#{item.id},#{item.outputId},#{item.dataTime},#{item.dataValue}) |
| | | (#{item.id},#{item.outputid},#{item.datatime},#{item.datavalue}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | <result property="isFuse" column="ISFUSE"/> |
| | | <result property="predictPhase" column="PREDICTPHASE"/> |
| | | <result property="workChecked" column="WORKCHECKED"/> |
| | | <result property="lastTime" column="last_time"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="MergeItemVO" type="com.iailab.module.model.mdk.vo.MergeItemVO"> |
| | |
| | | TDMI.ITEMORDER, |
| | | TMPI.STATUS, |
| | | TDMI.CATEGORYID, |
| | | TMIO.POINTID, |
| | | TMIO.TAGNAME, |
| | | TMIO.RESULTTABLEID, |
| | | TMRT.TABLENAME |
| | | TMIS.last_time, |
| | | TMIS.status run_status, |
| | | TMIS.duration |
| | | FROM T_MM_PREDICT_ITEM TMPI |
| | | LEFT JOIN T_MM_ITEM_TYPE TMIT ON TMIT.ID = TMPI.ITEMTYPEID |
| | | LEFT JOIN T_DM_MODULE_ITEM TDMI ON TDMI.ITEMID = TMPI.ID |
| | | LEFT JOIN T_MM_ITEM_OUTPUT TMIO ON TMIO.ITEMID = TMPI.ID |
| | | LEFT JOIN T_MM_RESULT_TABLE TMRT ON TMRT.ID = TMIO.RESULTTABLEID |
| | | LEFT JOIN t_mm_item_status TMIS ON TMIS.item_id = TMPI.ID |
| | | <where> |
| | | <if test="params.itemno != null and params.itemno != ''"> |
| | | AND TMPI.ITEMNO LIKE CONCAT('%', #{params.itemno},'%') |
| | |
| | | TDMI.MODULEID, |
| | | TDMI.ITEMORDER, |
| | | TMPI.STATUS, |
| | | TDMI.CATEGORYID, |
| | | TMIO.POINTID, |
| | | TMIO.TAGNAME, |
| | | TMIO.RESULTTABLEID, |
| | | TMRT.TABLENAME |
| | | TDMI.CATEGORYID |
| | | FROM T_MM_PREDICT_ITEM TMPI |
| | | LEFT JOIN T_MM_ITEM_TYPE TMIT ON TMIT.ID = TMPI.ITEMTYPEID |
| | | LEFT JOIN T_DM_MODULE_ITEM TDMI ON TDMI.ITEMID = TMPI.ID |
| | | LEFT JOIN T_MM_ITEM_OUTPUT TMIO ON TMIO.ITEMID = TMPI.ID |
| | | LEFT JOIN T_MM_RESULT_TABLE TMRT ON TMRT.ID = TMIO.RESULTTABLEID |
| | | WHERE 1 = 1 |
| | | <if test="itemno != null and itemno != ''"> |
| | | AND TMPI.ITEMNO LIKE CONCAT('%', #{itemno},'%') |
| | |
| | | t1.status, |
| | | t1.isfuse, |
| | | t1.predictphase, |
| | | t1.workchecked |
| | | t1.workchecked, |
| | | t3.last_time |
| | | FROM |
| | | t_mm_predict_item t1, |
| | | t_mm_item_type t2 |
| | | WHERE t1.itemtypeid=t2.id |
| | | <if test="ITEMID != null and ITEMID != ''"> |
| | | AND t1.id=#{ITEMID} |
| | | </if> |
| | | <if test="ITEMNO != null and ITEMNO != ''"> |
| | | t1.itemno=#{ITEMNO} |
| | | </if> |
| | | t_mm_predict_item t1 |
| | | LEFT JOIN t_mm_item_type t2 on t2.id = t1.itemtypeid |
| | | LEFT JOIN t_mm_item_status t3 on t3.item_id = t1.id |
| | | <where> |
| | | <if test="ITEMID != null and ITEMID != ''"> |
| | | AND t1.id=#{ITEMID} |
| | | </if> |
| | | <if test="ITEMNO != null and ITEMNO != ''"> |
| | | t1.itemno=#{ITEMNO} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="getMergeItemByItemId" parameterType="map" resultMap="MergeItemVO"> |
| | | SELECT t1.id, |