已修改3个文件
已删除91个文件
已添加202个文件
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.module.model.api.mcs.dto.AlarmMessageDTO; |
| | | import com.iailab.module.model.api.mcs.dto.PredictItemInfoDTO; |
| | | import com.iailab.module.model.api.mcs.dto.PredictItemTreeDTO; |
| | | import com.iailab.module.model.api.mcs.dto.ScheduleSuggestDTO; |
| | | import com.iailab.module.model.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.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @FeignClient(name = ApiConstants.NAME) |
| | | @Tag(name = "RPC 服务 - MCS") |
| | | public interface McsApi { |
| | | |
| | | String PREFIX = ApiConstants.PREFIX + "/mcs"; |
| | | |
| | | @GetMapping(PREFIX + "/predict-item-tree") |
| | | @Operation(summary = "预测项树") |
| | | CommonResult<List<PredictItemTreeDTO>> getPredictItemTree(); |
| | | |
| | | @GetMapping(PREFIX + "/predict-item-info") |
| | | @Operation(summary = "预测项详情") |
| | | CommonResult<PredictItemInfoDTO> getPredictItemInfo(@RequestParam Map<String, Object> params); |
| | | |
| | | @PostMapping(PREFIX + "/alarm-message/create") |
| | | @Operation(summary = "添加预警信息") |
| | | CommonResult<Boolean> createAlarmMessage(@RequestBody AlarmMessageDTO dto); |
| | | |
| | | @GetMapping(PREFIX + "/alarm-message/list") |
| | | @Operation(summary = "获取预警信息") |
| | | CommonResult<AlarmMessageDTO> listAlarmMessage(@RequestParam Map<String, Object> params); |
| | | |
| | | @PostMapping(PREFIX + "/schedule-suggest/create") |
| | | @Operation(summary = "添加调度建议") |
| | | CommonResult<Boolean> createScheduleSuggest(@RequestBody ScheduleSuggestDTO dto); |
| | | |
| | | @GetMapping(PREFIX + "/alarm-message/list") |
| | | @Operation(summary = "获取调度建议") |
| | | CommonResult<ScheduleSuggestDTO> listScheduleSuggest(@RequestParam Map<String, Object> params); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月29日 |
| | | */ |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月29日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 预警消息 DTO") |
| | | @Data |
| | | public class AlarmMessageDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "消息标题") |
| | | private String title; |
| | | |
| | | @Schema(description = "消息内容") |
| | | private String content; |
| | | |
| | | @Schema(description = "监控对象") |
| | | private String alarmObj; |
| | | |
| | | @Schema(description = "监控点位ID") |
| | | private String pointId; |
| | | |
| | | @Schema(description = "预测项ID") |
| | | private String itemId; |
| | | |
| | | @Schema(description = "当前值") |
| | | private BigDecimal currentValue; |
| | | |
| | | @Schema(description = "超出时间") |
| | | private Date outTime; |
| | | |
| | | @Schema(description = "超出值") |
| | | private BigDecimal outValue; |
| | | |
| | | @Schema(description = "预警类型") |
| | | private String alarmType; |
| | | |
| | | @Schema(description = "预警时间") |
| | | private Date alarmTime; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 预测数据 DTO") |
| | | @Data |
| | | public class PreDataViewReqDTO { |
| | | |
| | | @Schema(description = "预测项ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private String itemId; |
| | | |
| | | private String startTime; |
| | | |
| | | private String endTime; |
| | | |
| | | private Date predictTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 预测数据 DTO") |
| | | @Data |
| | | public class PreDataViewRespDTO { |
| | | |
| | | @Schema(description = "预测项ID") |
| | | private String itemId; |
| | | |
| | | @Schema(description = "预测项名称") |
| | | private String itemName; |
| | | |
| | | @Schema(description = "预测时间") |
| | | private Date predictTime; |
| | | |
| | | @Schema(description = "量程上限") |
| | | private BigDecimal rangeH; |
| | | |
| | | @Schema(description = "量程下限") |
| | | private BigDecimal rangeL; |
| | | |
| | | @Schema(description = "柜位上限") |
| | | private BigDecimal deadLineH; |
| | | |
| | | @Schema(description = "柜位下限") |
| | | private BigDecimal deadLineL; |
| | | |
| | | @Schema(description = "运行上限") |
| | | private BigDecimal limtH; |
| | | |
| | | @Schema(description = "运行下限") |
| | | private BigDecimal limtL; |
| | | |
| | | @Schema(description = "最大值") |
| | | private BigDecimal maxValue; |
| | | |
| | | @Schema(description = "最小值") |
| | | private BigDecimal minValue; |
| | | |
| | | @Schema(description = "历史最大值") |
| | | private BigDecimal hisMax; |
| | | |
| | | @Schema(description = "历史最小值") |
| | | private BigDecimal hisMin; |
| | | |
| | | @Schema(description = "历史平均值") |
| | | private BigDecimal hisAvg; |
| | | |
| | | @Schema(description = "历史最大值") |
| | | private BigDecimal hisCumulant; |
| | | |
| | | @Schema(description = "预测最大值") |
| | | private BigDecimal preMax; |
| | | |
| | | @Schema(description = "预测最小值") |
| | | private BigDecimal preMin; |
| | | |
| | | @Schema(description = "预测平均值") |
| | | private BigDecimal preAvg; |
| | | |
| | | @Schema(description = "预测累计值") |
| | | private BigDecimal preCumulant; |
| | | |
| | | @Schema(description = "属性") |
| | | private Map<String, Object> prop; |
| | | |
| | | @Schema(description = "真实值") |
| | | private List<Object[]> realData; |
| | | |
| | | @Schema(description = "T+N预测值,N表示预测频率") |
| | | private List<Object[]> preDataN; |
| | | |
| | | @Schema(description = "T+L预测值,L表示预测长度") |
| | | private List<Object[]> preDataL; |
| | | |
| | | @Schema(description = "当时预测值") |
| | | private List<Object[]> curData; |
| | | |
| | | @Schema(description = "调整值") |
| | | private List<Object[]> adjData; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | 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日 |
| | | */ |
| | | @Data |
| | | public class PredictItemInfoDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String itemId; |
| | | |
| | | private String itemNo; |
| | | |
| | | private String itemName; |
| | | |
| | | private BigDecimal predictLength; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年07月31日 |
| | | */ |
| | | @Data |
| | | public class PredictItemTreeDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String id; |
| | | |
| | | private String label; |
| | | |
| | | private List<PredictItemTreeDTO> children; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mcs.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月29日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 调度建议 DTO") |
| | | @Data |
| | | public class ScheduleSuggestDTO implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "标题") |
| | | private String title; |
| | | |
| | | @Schema(description = "内容") |
| | | private String content; |
| | | |
| | | @Schema(description = "排序") |
| | | private Integer sort; |
| | | |
| | | @Schema(description = "预警ID") |
| | | private String alarmId; |
| | | |
| | | @Schema(description = "预测项ID") |
| | | private String itemId; |
| | | |
| | | @Schema(description = "模型ID") |
| | | private String modelId; |
| | | |
| | | @Schema(description = "调整对象") |
| | | private String adjustObj; |
| | | |
| | | @Schema(description = "调整介质") |
| | | private String adjustMedium; |
| | | |
| | | @Schema(description = "调整策略") |
| | | private String adjustStrategy; |
| | | |
| | | @Schema(description = "调整方式") |
| | | private String adjustMode; |
| | | |
| | | @Schema(description = "调整值") |
| | | private BigDecimal adjustValue; |
| | | |
| | | @Schema(description = "调整单位") |
| | | private String adjustUnit; |
| | | |
| | | @Schema(description = "持续时长") |
| | | private BigDecimal adjustTimes; |
| | | |
| | | @Schema(description = "调整开始时间") |
| | | private Date adjustStart; |
| | | |
| | | @Schema(description = "调整结束时间") |
| | | private Date adjustEnd; |
| | | |
| | | @Schema(description = "建议时间") |
| | | private Date suggestTime; |
| | | |
| | | @Schema(description = "状态(0未处理 1已采纳 2已忽略)") |
| | | private Integer status; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mdk; |
| | | |
| | | import com.iailab.module.model.api.mdk.dto.*; |
| | | import com.iailab.module.model.enums.ApiConstants; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | 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.RequestBody; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @FeignClient(name = ApiConstants.NAME) |
| | | @Tag(name = "RPC 服务 - MDK") |
| | | public interface MdkApi { |
| | | |
| | | String PREFIX = ApiConstants.PREFIX + "/mdk"; |
| | | |
| | | @GetMapping(PREFIX + "/predict-module") |
| | | @Operation(summary = "模块预测") |
| | | CommonResult<MdkPredictModuleRespDTO> predictModule(@Valid @RequestBody MdkPredictReqDTO reqDTO); |
| | | |
| | | @GetMapping(PREFIX + "/predict-item") |
| | | @Operation(summary = "单独预测") |
| | | CommonResult<MdkPredictItemRespDTO> predictItem(@Valid @RequestBody MdkPredictReqDTO reqDTO); |
| | | |
| | | @GetMapping(PREFIX + "/predict-auto-adjust") |
| | | @Operation(summary = "预测自动调整") |
| | | CommonResult<Boolean> predictAutoAdjust(@Valid @RequestBody MdkPredictReqDTO reqDTO); |
| | | |
| | | |
| | | @GetMapping(PREFIX + "/schedule") |
| | | @Operation(summary = "执行调度") |
| | | CommonResult<MdkScheduleRespDTO> doSchedule(@Valid @RequestBody MdkScheduleReqDTO reqDTO); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 预测数据 DTO") |
| | | @Data |
| | | public class MdkPredictDataDTO { |
| | | |
| | | private Date dataTime; |
| | | |
| | | private Double dataValue; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 调度 DTO") |
| | | @Data |
| | | public class MdkPredictItemRespDTO { |
| | | |
| | | private String itemId; |
| | | |
| | | private Date predictTime; |
| | | |
| | | private List<MdkPredictDataDTO> predictData; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 调度 DTO") |
| | | @Data |
| | | public class MdkPredictModuleRespDTO { |
| | | |
| | | private Date predictTime; |
| | | |
| | | private String moduleType; |
| | | |
| | | private Map<String, MdkPredictItemRespDTO> predictItemRespMap; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 预测 DTO") |
| | | @Data |
| | | public class MdkPredictReqDTO { |
| | | |
| | | private Date predictTime; |
| | | |
| | | private String moduleType; |
| | | |
| | | private String itemNo; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 调度 DTO") |
| | | @Data |
| | | public class MdkScheduleReqDTO { |
| | | |
| | | private Date scheduleTime; |
| | | |
| | | private String modelCode; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.api.mdk.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Schema(description = "RPC 模型 - 调度 DTO") |
| | | @Data |
| | | public class MdkScheduleRespDTO { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.enums; |
| | | |
| | | import com.iailab.framework.common.enums.RpcConstants; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | public class ApiConstants { |
| | | /** |
| | | * 服务名 |
| | | * |
| | | * 注意,需要保证和 spring.application.name 保持一致 |
| | | */ |
| | | public static final String NAME = "model-server"; |
| | | |
| | | public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/model"; |
| | | |
| | | public static final String VERSION = "1.0.0"; |
| | | } |
| | |
| | | ) engine = innodb |
| | | default character set utf8mb4; |
| | | |
| | | create table |
| | | t_mm_predict_alarm_message |
| | | create table t_mm_predict_alarm_config |
| | | ( |
| | | id varchar(64) not null, |
| | | item_id varchar(64), |
| | | title varchar(64), |
| | | content varchar(128), |
| | | predict_time datetime, |
| | | out_time datetime, |
| | | create_time datetime default current_timestamp, |
| | | type varchar(64), |
| | | id varchar(36) not null, |
| | | title varchar(36) 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), |
| | | key idx_item_id (item_id), |
| | | key idx_type (type) |
| | | key idx_alarm_obj (alarm_obj), |
| | | key idx_alarm_time (alarm_time) |
| | | ) engine = innodb |
| | | default character set utf8mb4; |
| | | default character set utf8mb4 COMMENT = '预警消息表'; |
| | | |
| | | create table |
| | | t_mm_item_result_json |
| | |
| | | create table |
| | | t_st_schedule_suggest |
| | | ( |
| | | id varchar(64) not null, |
| | | title varchar(128), |
| | | content varchar(256), |
| | | order_index integer, |
| | | type varchar(64), |
| | | item_id varchar(64), |
| | | is_adjusted integer, |
| | | model_id varchar(64), |
| | | create_time datetime default current_timestamp, |
| | | id varchar(36) not null, |
| | | title varchar(50) COMMENT '标题', |
| | | content varchar(256) COMMENT '内容', |
| | | sort integer COMMENT '排序', |
| | | alarm_id varchar(36) COMMENT '预警ID', |
| | | item_id varchar(36) COMMENT '预测项ID', |
| | | model_id varchar(36) COMMENT '模型ID', |
| | | adjust_obj varchar(20) COMMENT '调整对象', |
| | | adjust_medium varchar(20) COMMENT '调整介质', |
| | | adjust_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 '调整结束时间', |
| | | suggest_time datetime COMMENT '建议时间', |
| | | status tinyint NOT NULL COMMENT '状态(0未处理 1已采纳 2已忽略)', |
| | | create_time datetime default current_timestamp COMMENT '创建时间', |
| | | primary key (id), |
| | | key idx_model_id (model_id), |
| | | key idx_type (type) |
| | | ) engine = innodb |
| | | default character set utf8mb4; |
| | | default character set utf8mb4 COMMENT = '调度建议表'; |
| | |
| | | <maven.compiler.source>8</maven.compiler.source> |
| | | <maven.compiler.target>8</maven.compiler.target> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <mdk.version>MDK.taisteel.202308231710</mdk.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | |
| | | <version>2.3.2</version> |
| | | </dependency> |
| | | |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.quartz-scheduler</groupId>--> |
| | | <!-- <artifactId>quartz</artifactId>--> |
| | | <!-- <version>${quartz.version}</version>--> |
| | | <!-- <exclusions>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>com.mchange</groupId>--> |
| | | <!-- <artifactId>c3p0</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- <exclusion>--> |
| | | <!-- <groupId>com.zaxxer</groupId>--> |
| | | <!-- <artifactId>HikariCP-java6</artifactId>--> |
| | | <!-- </exclusion>--> |
| | | <!-- </exclusions>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>cn.afterturn</groupId>--> |
| | | <!-- <artifactId>easypoi-base</artifactId>--> |
| | | <!-- <version>${easypoi.version}</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>cn.afterturn</groupId>--> |
| | | <!-- <artifactId>easypoi-web</artifactId>--> |
| | | <!-- <version>${easypoi.version}</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>cn.afterturn</groupId>--> |
| | | <!-- <artifactId>easypoi-annotation</artifactId>--> |
| | | <!-- <version>${easypoi.version}</version>--> |
| | | <!-- </dependency>--> |
| | | |
| | | <!-- 引用POI --> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | <!-- ModBus TCP --> |
| | | <dependency> |
| | | <groupId>com.infiniteautomation</groupId> |
| | | <artifactId>modbus4j</artifactId> |
| | | <version>3.0.4</version> |
| | | </dependency> |
| | | |
| | | <!-- OPC UA --> |
| | | <dependency> |
| | | <groupId>org.eclipse.milo</groupId> |
| | | <artifactId>sdk-client</artifactId> |
| | | <version>0.6.9</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.eclipse.milo</groupId> |
| | | <artifactId>sdk-server</artifactId> |
| | | <version>0.6.9</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.guava</groupId> |
| | | <artifactId>guava</artifactId> |
| | | <version>31.0.1-jre</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.quartz-scheduler</groupId> |
| | | <artifactId>quartz</artifactId> |
| | | <version>2.3.2</version> |
| | | </dependency> |
| | | <!-- influxdb --> |
| | | <dependency> |
| | | <groupId>com.influxdb</groupId> |
| | | <artifactId>influxdb-client-java</artifactId> |
| | | <version>6.8.0</version> |
| | | </dependency> |
| | | |
| | | <!-- websocket --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-websocket</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.iailab</groupId> |
| | | <artifactId>iailab-module-data-biz</artifactId> |
| | |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <!-- 引用MDK --> |
| | | <dependency> |
| | | <groupId>com.iail</groupId> |
| | | <artifactId>IAILMDK</artifactId> |
| | | <version>0.94.9</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.iail</groupId> |
| | | <artifactId>MDK</artifactId> |
| | | <version>${mdk.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.iail</groupId> |
| | | <artifactId>IAILMDK</artifactId> |
| | | <version>0.94.9</version> |
| | | </dependency> |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | import org.springframework.boot.CommandLineRunner; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import com.iail.IAILMDK; |
| | | import org.springframework.scheduling.annotation.EnableAsync; |
| | | |
| | | import java.io.InputStream; |
| | | import java.util.Properties; |
| | | |
| | | @EnableAsync |
| | | @SpringBootApplication |
| | | public class ModelServiceApplication implements CommandLineRunner { |
| | | |
| | | static { |
| | | //加载动态链接库 |
| | | try { |
| | | Properties properties = new Properties(); |
| | | InputStream in = ModelServiceApplication.class.getClassLoader().getResourceAsStream("iailmdk.properties"); |
| | | properties.load(in); |
| | | String mdkInitPath = properties.getProperty("mdk-init-path"); |
| | | System.out.println("mdkInitPath=" + mdkInitPath); |
| | | IAILMDK.initWithBean(mdkInitPath, false); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | System.out.println("动态链接库IAILMDK初始化失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(ModelServiceApplication.class, args); |
对比新文件 |
| | |
| | | package com.iailab.module.model.api; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | 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 com.iailab.module.model.mdk.predict.PredictModuleHandler; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.validation.Valid; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月26日 |
| | | */ |
| | | @Slf4j |
| | | @RestController |
| | | @Validated |
| | | public class MdkApiImpl implements MdkApi { |
| | | |
| | | @Autowired |
| | | private DmModuleService dmModuleService; |
| | | |
| | | @Autowired |
| | | private MmPredictItemService mmPredictItemService; |
| | | |
| | | @Autowired |
| | | private PredictModuleHandler predictModuleHandler; |
| | | |
| | | /** |
| | | * 按模块预测 |
| | | * |
| | | * @param reqDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult<MdkPredictModuleRespDTO> predictModule(MdkPredictReqDTO reqDTO) { |
| | | MdkPredictModuleRespDTO resp = new MdkPredictModuleRespDTO(); |
| | | Map<String, MdkPredictItemRespDTO> predictItemRespMap = new HashMap<>(); |
| | | try { |
| | | if (reqDTO.getPredictTime() == null) { |
| | | throw new Exception("PredictTime不能为空"); |
| | | } |
| | | if (reqDTO.getModuleType() == null) { |
| | | throw new Exception("ModuleType不能为空"); |
| | | } |
| | | log.info("预测参数:" + JSON.toJSONString(reqDTO)); |
| | | MdkPredictModuleRespDTO result = new MdkPredictModuleRespDTO(); |
| | | result.setPredictTime(reqDTO.getPredictTime()); |
| | | result.setModuleType(reqDTO.getModuleType()); |
| | | List<DmModuleEntity> moduleList = dmModuleService.getModuleByModuleType(reqDTO.getModuleType()); |
| | | log.info("预测计算开始: " + System.currentTimeMillis()); |
| | | for (DmModuleEntity module : moduleList) { |
| | | int intervalTime = 0; |
| | | if (module.getPredicttime() != null) { |
| | | intervalTime = (int) (reqDTO.getPredictTime().getTime() - module.getPredicttime().getTime()) / (1000 * 60); |
| | | } |
| | | List<ItemVO> predictItemList = mmPredictItemService.getByModuleId(module.getId()); |
| | | Map<String, PredictResultVO> predictResultMap = predictModuleHandler.predict(predictItemList, reqDTO.getPredictTime(), intervalTime); |
| | | 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); |
| | | predictItemRespMap.put(entry.getKey(), itemResp); |
| | | } |
| | | } |
| | | log.info("预测计算结束: " + System.currentTimeMillis()); |
| | | } catch (Exception ex) { |
| | | return error(999, ex.getMessage()); |
| | | } |
| | | resp.setPredictItemRespMap(predictItemRespMap); |
| | | return success(resp); |
| | | } |
| | | |
| | | /** |
| | | * 单个预测 |
| | | * |
| | | * @param reqDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult<MdkPredictItemRespDTO> predictItem(@Valid @RequestBody MdkPredictReqDTO reqDTO) { |
| | | MdkPredictItemRespDTO resp = new MdkPredictItemRespDTO(); |
| | | |
| | | return success(resp); |
| | | } |
| | | |
| | | /** |
| | | * 预测调整 |
| | | * |
| | | * @param reqDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult<Boolean> predictAutoAdjust(@Valid @RequestBody MdkPredictReqDTO reqDTO) { |
| | | |
| | | |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 执行调度模型 |
| | | * |
| | | * @param reqDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public CommonResult<MdkScheduleRespDTO> doSchedule(@Valid @RequestBody MdkScheduleReqDTO reqDTO) { |
| | | MdkScheduleRespDTO resp = new MdkScheduleRespDTO(); |
| | | |
| | | return success(resp); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.controller; |
| | | |
| | | import com.iailab.framework.common.exception.ErrorCode; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.service.DmModuleService; |
| | | import com.iailab.module.model.mcs.pre.vo.DmModulePageReqVO; |
| | | import com.iailab.module.model.mcs.pre.vo.DmModuleRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 9:05 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/pre/module") |
| | | public class DmModuleController { |
| | | |
| | | @Autowired |
| | | private DmModuleService dmModuleService; |
| | | |
| | | /** |
| | | * 管网列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<DmModuleRespVO>> page(@Validated DmModulePageReqVO reqVO) { |
| | | PageResult<DmModuleEntity> page = dmModuleService.queryPage(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, DmModuleRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 管网列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public CommonResult<List<DmModuleEntity>> list(@RequestParam Map<String, Object> params) { |
| | | List<DmModuleEntity> list = dmModuleService.list(params); |
| | | |
| | | return success(list); |
| | | } |
| | | |
| | | /** |
| | | * 管网信息 |
| | | */ |
| | | @GetMapping("/get") |
| | | public CommonResult<DmModuleEntity> info(@RequestParam("id") String id){ |
| | | DmModuleEntity module = dmModuleService.selectById(id); |
| | | |
| | | return success(module); |
| | | } |
| | | |
| | | /** |
| | | * 保存管网 |
| | | */ |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> save(@RequestBody DmModuleEntity module){ |
| | | int count = dmModuleService.check(module); |
| | | if (count > 0) { |
| | | ErrorCode errorCode = new ErrorCode(999, "名称重复"); |
| | | return error(errorCode); |
| | | } |
| | | dmModuleService.saveModule(module); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改管网 |
| | | */ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody DmModuleEntity module){ |
| | | dmModuleService.update(module); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除管网 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id){ |
| | | dmModuleService.deleteBatch(new String[]{id}); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.controller; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.dto.MmItemOutputDTO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月23日 11:13 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/pre/item-output") |
| | | public class MmItemOutputController { |
| | | |
| | | @Autowired |
| | | private MmItemOutputService mmItemOutputService; |
| | | |
| | | /** |
| | | * 预测项输出列表 |
| | | */ |
| | | @GetMapping("/list/all") |
| | | public CommonResult<List<MmItemOutputDTO>> queryAll(@RequestParam Map<String, Object> params){ |
| | | List<MmItemOutputDTO> data = mmItemOutputService.queryList(params); |
| | | return success(data); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.controller; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemTypeService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月22日 9:57 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/pre/item-type") |
| | | public class MmItemTypeController { |
| | | |
| | | @Autowired |
| | | private MmItemTypeService mmItemTypeService; |
| | | |
| | | /** |
| | | * 预测项类型列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmItemTypePageReqVO reqVO) { |
| | | PageResult<MmItemTypeEntity> page = mmItemTypeService.page(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, MmItemTypeRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 预测项类型信息 |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<MmItemTypeEntity> info(@PathVariable("id") String id) { |
| | | MmItemTypeEntity itemType = mmItemTypeService.selectById(id); |
| | | |
| | | return success(itemType); |
| | | } |
| | | |
| | | /** |
| | | * 保存预测项类型 |
| | | */ |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> save(@RequestBody MmItemTypeEntity itemType) { |
| | | int count = mmItemTypeService.check(itemType); |
| | | if (count > 0) { |
| | | return error(999,"名称重复"); |
| | | } |
| | | mmItemTypeService.saveItemType(itemType); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改预测项类型 |
| | | */ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody MmItemTypeEntity itemType) { |
| | | int count = mmItemTypeService.check(itemType); |
| | | if (count > 0) { |
| | | return error(999,"名称重复"); |
| | | } |
| | | mmItemTypeService.update(itemType); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除预测项类型 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | mmItemTypeService.deleteBatch(new String[]{id}); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.controller; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelResultstrEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelResultstrService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmModelResultstrPageReqVO; |
| | | import com.iailab.module.model.mcs.pre.vo.MmModelResultstrRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月07日 16:53 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/pre/model-resultstr") |
| | | public class MmModelResultstrController { |
| | | |
| | | @Autowired |
| | | private MmModelResultstrService mmModelResultstrService; |
| | | |
| | | /** |
| | | * 预测项结果列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<MmModelResultstrRespVO>> page(@Validated MmModelResultstrPageReqVO reqVO) { |
| | | PageResult<MmModelResultstrEntity> page = mmModelResultstrService.page(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, MmModelResultstrRespVO.class)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.controller; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | | import com.iailab.module.model.mcs.pre.vo.CountItemtypeVO; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 14:42 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/pre/predict-item") |
| | | public class MmPredictItemController { |
| | | |
| | | @Autowired |
| | | private MmPredictItemService mmPredictItemService; |
| | | |
| | | /** |
| | | * 预测项列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<MmPredictItemRespVO>> page(@RequestParam Map<String, Object> params) { |
| | | PageResult<MmPredictItemRespVO> page = mmPredictItemService.getPageList(params); |
| | | return success(page); |
| | | } |
| | | |
| | | /** |
| | | * 预测项信息 |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<MmPredictItemDTO> info(@PathVariable("id") String id, @RequestParam Map<String, Object> params){ |
| | | MmPredictItemDTO predictItem = mmPredictItemService.getDetailById(id, params); |
| | | return success(predictItem); |
| | | } |
| | | |
| | | /** |
| | | * 保存预测项 |
| | | */ |
| | | @PostMapping |
| | | public CommonResult<Boolean> save(@RequestBody MmPredictItemDTO mmPredictItemDto){ |
| | | int count = mmPredictItemService.check(mmPredictItemDto.getMmPredictItem()); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | mmPredictItemService.savePredictItem(mmPredictItemDto); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改预测项 |
| | | */ |
| | | @PutMapping |
| | | public CommonResult<Boolean> update(@RequestBody MmPredictItemDTO mmPredictItemDto){ |
| | | int count = mmPredictItemService.check(mmPredictItemDto.getMmPredictItem()); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | mmPredictItemService.update(mmPredictItemDto); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除预测项 |
| | | */ |
| | | @DeleteMapping("{id}") |
| | | public CommonResult<Boolean> delete(@RequestBody String[] itemIds){ |
| | | if (itemIds == null || itemIds.length == 0) { |
| | | return error(999, "参数不能为空"); |
| | | } |
| | | mmPredictItemService.deleteBatch(itemIds); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 预测项列表 |
| | | */ |
| | | @GetMapping("/count-itemtype") |
| | | public CommonResult<List<CountItemtypeVO>> countItemtype(@RequestParam Map<String, Object> params){ |
| | | List<CountItemtypeVO> list = new ArrayList<>(); |
| | | return success(list); |
| | | } |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | @GetMapping("/count") |
| | | public CommonResult<Long> count() { |
| | | Long count = mmPredictItemService.count(); |
| | | return success(count); |
| | | } |
| | | |
| | | /** |
| | | * 上传模型 |
| | | */ |
| | | @PostMapping("/uploadModel") |
| | | public CommonResult<Boolean> uploadModel(@RequestParam("file") MultipartFile file) throws Exception { |
| | | |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.controller; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmResultTableService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemTypeRespVO; |
| | | import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月22日 9:57 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/pre/result-table") |
| | | public class MmResultTableController { |
| | | |
| | | @Autowired |
| | | private MmResultTableService mmResultTableService; |
| | | |
| | | /** |
| | | * 结果存放列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<MmItemTypeRespVO>> page(@Validated MmResultTablePageReqVO reqVO) { |
| | | PageResult<MmResultTableEntity> page = mmResultTableService.page(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, MmItemTypeRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<MmResultTableEntity> info(@PathVariable("id") String id){ |
| | | MmResultTableEntity resultTable = mmResultTableService.selectById(id); |
| | | |
| | | return success(resultTable); |
| | | } |
| | | |
| | | /** |
| | | * 保存结果存放 |
| | | */ |
| | | @PostMapping |
| | | public CommonResult<Boolean> save(@RequestBody MmResultTableEntity resultTable){ |
| | | int count = mmResultTableService.check(resultTable); |
| | | if (count > 0) { |
| | | return error(999,"名称重复"); |
| | | } |
| | | mmResultTableService.saveResultTable(resultTable); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改结果存放 |
| | | */ |
| | | @PutMapping |
| | | public CommonResult<Boolean> update(@RequestBody MmResultTableEntity resultTable){ |
| | | int count = mmResultTableService.check(resultTable); |
| | | if (count > 0) { |
| | | return error(999,"名称重复"); |
| | | } |
| | | mmResultTableService.update(resultTable); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除结果存放 |
| | | */ |
| | | @DeleteMapping("{id}") |
| | | public CommonResult<Boolean> delete(@RequestBody String[] ids){ |
| | | mmResultTableService.deleteBatch(ids); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.DmModulePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 8:30 |
| | | */ |
| | | @Mapper |
| | | public interface DmModuleDao extends BaseMapperX<DmModuleEntity> { |
| | | |
| | | default PageResult<DmModuleEntity> selectPage(DmModulePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<DmModuleEntity>() |
| | | .likeIfPresent(DmModuleEntity::getModulename, reqVO.getModulename()) |
| | | .orderByDesc(DmModuleEntity::getCreateTime)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleItemEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 8:39 |
| | | */ |
| | | @Mapper |
| | | public interface DmModuleItemDao extends BaseMapperX<DmModuleItemEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.dto.MmItemOutputDTO; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 8:43 |
| | | */ |
| | | @Mapper |
| | | public interface MmItemOutputDao extends BaseMapperX<MmItemOutputEntity> { |
| | | |
| | | List<MmItemOutputDTO> queryList(@Param("params") Map<String, Object> params); |
| | | |
| | | List<MmItemOutputVO> getOutPutById(String outputid); |
| | | |
| | | List<MmItemOutputVO> getOutPutByItemId(String itemid); |
| | | |
| | | List<MmItemOutputVO> getOutPutByPointId(String pointid); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月28日 10:27 |
| | | */ |
| | | @Mapper |
| | | public interface MmItemResultDao extends BaseMapperX<MmItemResultEntity> { |
| | | |
| | | void deletePredictValue(Map<String, Object> params); |
| | | |
| | | void savePredictValue(Map<String, Object> params); |
| | | |
| | | void savePredictJsonValue(Map<String, Object> params); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 15:23 |
| | | */ |
| | | @Mapper |
| | | public interface MmItemTypeDao extends BaseMapperX<MmItemTypeEntity> { |
| | | |
| | | default PageResult<MmItemTypeEntity> selectPage(MmItemTypePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MmItemTypeEntity>() |
| | | .likeIfPresent(MmItemTypeEntity::getItemtypename, reqVO.getItemtypename()) |
| | | .orderByDesc(MmItemTypeEntity::getItemtypename)); |
| | | } |
| | | |
| | | List<MmItemTypeEntity> getItemTypeByItemId(String itemId); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 8:58 |
| | | */ |
| | | @Mapper |
| | | public interface MmModelArithSettingsDao extends BaseMapperX<MmModelArithSettingsEntity> { |
| | | |
| | | /** |
| | | * getMmModelArithSettings |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<MmModelArithSettingsEntity> getMmModelArithSettings(Map<String, Object> params); |
| | | |
| | | /** |
| | | * insertList |
| | | * |
| | | * @param list |
| | | */ |
| | | void insertList(List<MmModelArithSettingsEntity> list); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 8:55 |
| | | */ |
| | | @Mapper |
| | | public interface MmModelParamDao extends BaseMapperX<MmModelParamEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelResultstrEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.MmModelResultstrPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月07日 16:38 |
| | | */ |
| | | @Mapper |
| | | public interface MmModelResultstrDao extends BaseMapperX<MmModelResultstrEntity> { |
| | | |
| | | default PageResult<MmModelResultstrEntity> selectPage(MmModelResultstrPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MmModelResultstrEntity>() |
| | | .likeIfPresent(MmModelResultstrEntity::getResultstr, reqVO.getResultstr()) |
| | | .orderByDesc(MmModelResultstrEntity::getResultstr)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictItemEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictItemEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemPageReqVO; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.MergeItemVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 11:35 |
| | | */ |
| | | @Mapper |
| | | public interface MmPredictItemDao extends BaseMapperX<MmPredictItemEntity> { |
| | | |
| | | /** |
| | | * 查询列表 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | IPage<MmPredictItemRespVO> getPageList(IPage<MmPredictItemEntity> page, @Param("params") Map<String, Object> params); |
| | | |
| | | List<ItemVO> getByModuleId(Map<String, Object> params); |
| | | |
| | | List<ItemVO> getItem(Map<String, Object> params); |
| | | |
| | | List<MergeItemVO> getMergeItemByItemId(Map<String, Object> params); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.common.dao.BaseDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictMergeItemEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 8:50 |
| | | */ |
| | | @Mapper |
| | | public interface MmPredictMergeItemDao extends BaseDao<MmPredictMergeItemEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 11:29 |
| | | */ |
| | | @Mapper |
| | | public interface MmPredictModelDao extends BaseMapperX<MmPredictModelEntity> { |
| | | |
| | | List<MmPredictModelEntity> getNoSettingmapPredictModel(Map<String, Object> params); |
| | | |
| | | List<MmPredictModelEntity> getActiveModelByItemId(String itemId); |
| | | |
| | | List<MmPredictModelEntity> getSampleLength(String modelId); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 16:20 |
| | | */ |
| | | @Mapper |
| | | public interface MmResultTableDao extends BaseMapperX<MmResultTableEntity> { |
| | | |
| | | default PageResult<MmResultTableEntity> selectPage(MmResultTablePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MmResultTableEntity>() |
| | | .likeIfPresent(MmResultTableEntity::getTablename, reqVO.getTablename()) |
| | | .orderByDesc(MmResultTableEntity::getTablename)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.iailab.module.model.mcs.pre.entity.SequenceNumEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月06日 13:07 |
| | | */ |
| | | @Mapper |
| | | public interface SequenceNumDao extends BaseMapper<SequenceNumEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月23日 10:13 |
| | | */ |
| | | @Data |
| | | public class MmItemOutputDTO { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String itemid; |
| | | |
| | | /** |
| | | * 数据点ID |
| | | */ |
| | | private String pointid; |
| | | |
| | | /** |
| | | * 存放表ID |
| | | */ |
| | | private String resulttableid; |
| | | |
| | | /** |
| | | * 数据点名称 |
| | | */ |
| | | private String tagname; |
| | | |
| | | /** |
| | | * 预测项名称 |
| | | */ |
| | | private String itemname; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.dto; |
| | | |
| | | import com.iailab.module.model.mcs.pre.entity.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 16:27 |
| | | */ |
| | | @Data |
| | | public class MmPredictItemDTO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private MmPredictItemEntity mmPredictItem; |
| | | |
| | | private DmModuleItemEntity dmModuleItem; |
| | | |
| | | private MmItemOutputEntity mmItemOutput; |
| | | |
| | | private MmPredictModelEntity mmPredictModel; |
| | | |
| | | private MmPredictMergeItemEntity mmPredictMergeItem; |
| | | |
| | | private List<MmModelArithSettingsEntity> mmModelArithSettingsList; |
| | | |
| | | private List<MmModelParamEntity> mmModelParamList; |
| | | |
| | | private List<MmItemResultEntity> mmItemResultList; |
| | | } |
对比新文件 |
| | |
| | | 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 com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月22日 18:00 |
| | | */ |
| | | @Data |
| | | @TableName("T_DM_MODULE") |
| | | public class DmModuleEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @NotBlank(message="名称不能为空") |
| | | private String modulename; |
| | | |
| | | /** |
| | | * 类型 |
| | | */ |
| | | @NotBlank(message="类型") |
| | | private String moduletype; |
| | | |
| | | /** |
| | | * 周期 |
| | | */ |
| | | @NotNull(message="周期") |
| | | private BigDecimal cycle; |
| | | |
| | | /** |
| | | * 模块配置 |
| | | */ |
| | | private String modulenavconfig; |
| | | |
| | | /** |
| | | * 预测时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date predicttime; |
| | | |
| | | /** |
| | | * 收集时间 |
| | | */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date collecttime; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月25日 16:00 |
| | | */ |
| | | @Data |
| | | @TableName("T_DM_MODULE_ITEM") |
| | | public class DmModuleItemEntity implements Serializable { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 管网ID |
| | | */ |
| | | @NotBlank(message="管网ID不能为空") |
| | | private String moduleid; |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String itemid; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | @NotNull(message="排序不能为空不能为空") |
| | | private Integer itemorder; |
| | | |
| | | /** |
| | | * 是否启用 |
| | | */ |
| | | @NotNull(message="是否启用不能为空") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 类别ID |
| | | */ |
| | | @NotBlank(message="类别ID不能为空") |
| | | private String categoryid; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月25日 16:23 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_ITEM_OUTPUT") |
| | | public class MmItemOutputEntity implements Serializable { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String itemid; |
| | | |
| | | /** |
| | | * 数据点ID |
| | | */ |
| | | @NotBlank(message="数据点ID不能为空") |
| | | private String pointid; |
| | | |
| | | /** |
| | | * 存放表ID |
| | | */ |
| | | @NotBlank(message="存放表ID不能为空") |
| | | private String resulttableid; |
| | | |
| | | /** |
| | | * 数据点名称 |
| | | */ |
| | | @NotBlank(message="数据点名称不能为空") |
| | | private String tagname; |
| | | |
| | | /** |
| | | * 排序(默认值1) |
| | | */ |
| | | private BigDecimal outputorder; |
| | | } |
对比新文件 |
| | |
| | | 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 |
| | | * @date 2021年05月28日 10:18 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_ITEM_RESULT") |
| | | public class MmItemResultEntity implements Serializable { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 输出ID |
| | | */ |
| | | private String outputid; |
| | | |
| | | /** |
| | | * 预测时间 |
| | | */ |
| | | private Date datatime; |
| | | |
| | | /** |
| | | * 预测值 |
| | | */ |
| | | private BigDecimal datavalue; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月02日 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_ITEM_RESULT") |
| | | public class MmItemResultJsonEntity implements Serializable { |
| | | |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | private String outputid; |
| | | |
| | | private Date predicttime; |
| | | |
| | | private String jsonvalue; |
| | | |
| | | private String cumulant; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 15:17 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_ITEM_TYPE") |
| | | public class MmItemTypeEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @NotBlank(message="名称不能为空") |
| | | private String itemtypename; |
| | | |
| | | /** |
| | | * 类名 |
| | | */ |
| | | @NotNull(message="类名不能为空") |
| | | private String itemclasstype; |
| | | |
| | | /** |
| | | * 程序集 |
| | | */ |
| | | private String assemblyname; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月25日 17:29 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_MODEL_ARITH_SETTINGS") |
| | | public class MmModelArithSettingsEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 模型ID |
| | | */ |
| | | @NotBlank(message="模型ID不能为空") |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 键 |
| | | */ |
| | | @NotBlank(message="键不能为空") |
| | | private String key; |
| | | |
| | | /** |
| | | * 值 |
| | | */ |
| | | @NotBlank(message="值不能为空") |
| | | private String value; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @NotBlank(message="名称不能为空") |
| | | private String name; |
| | | |
| | | /** |
| | | * 类型 |
| | | */ |
| | | @NotBlank(message="类型不能为空") |
| | | private String valuetype; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月25日 17:47 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_MODEL_PARAM") |
| | | public class MmModelParamEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 模型ID |
| | | */ |
| | | @NotBlank(message="模型ID不能为空") |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 参数名称 |
| | | */ |
| | | @NotBlank(message="参数名称不能为空") |
| | | private String modelparamname; |
| | | |
| | | /** |
| | | * 参数ID |
| | | */ |
| | | @NotBlank(message="参数ID不能为空") |
| | | private String modelparamid; |
| | | |
| | | /** |
| | | * 序号 |
| | | */ |
| | | @NotBlank(message="序号不能为空") |
| | | private Integer modelparamorder; |
| | | |
| | | /** |
| | | * 端口 |
| | | */ |
| | | @NotBlank(message="端口不能为空") |
| | | private Integer modelparamportorder; |
| | | |
| | | /** |
| | | * 参数长度 |
| | | */ |
| | | @NotNull(message="参数不能为空") |
| | | private Integer datalength; |
| | | |
| | | /** |
| | | * 参数类型 |
| | | */ |
| | | @NotBlank(message="参数类型不能为空") |
| | | private String modelparamtype; |
| | | } |
对比新文件 |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月07日 16:36 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_MODEL_RESULTSTR") |
| | | public class MmModelResultstrEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 结果 |
| | | */ |
| | | private String resultstr; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月25日 15:05 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_PREDICT_ITEM") |
| | | public class MmPredictItemEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | private String itemno; |
| | | |
| | | /** |
| | | * 预测项名 |
| | | */ |
| | | @NotBlank(message="预测项名不能为空") |
| | | private String itemname; |
| | | |
| | | /** |
| | | * 计算类型 |
| | | */ |
| | | private String caltypeid; |
| | | |
| | | /** |
| | | * 类型 |
| | | */ |
| | | @NotBlank(message="类型不能为空") |
| | | private String itemtypeid; |
| | | |
| | | /** |
| | | * 预测长度 |
| | | */ |
| | | private BigDecimal predictlength; |
| | | |
| | | /** |
| | | * 粒度 |
| | | */ |
| | | private BigDecimal granularity; |
| | | |
| | | /** |
| | | * 是否启用 |
| | | */ |
| | | private BigDecimal status; |
| | | |
| | | /** |
| | | * isfuse |
| | | */ |
| | | private BigDecimal isfuse; |
| | | |
| | | /** |
| | | * predictphase |
| | | */ |
| | | private BigDecimal predictphase; |
| | | |
| | | /** |
| | | * 是否检查 |
| | | */ |
| | | private BigDecimal workchecked; |
| | | |
| | | /** |
| | | * unittransfactor |
| | | */ |
| | | private BigDecimal unittransfactor; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 保留的预测点位 (T+2 则n=2, T+30则n=30, T+n则表示从最后点位开始,n=预测长度;n由系统配置得出) |
| | | */ |
| | | private String saveindex; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 8:33 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_PREDICT_MERGE_ITEM") |
| | | public class MmPredictMergeItemEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String itemid; |
| | | |
| | | /** |
| | | * 表达式 |
| | | */ |
| | | @NotBlank(message="表达式不能为空") |
| | | private String expression; |
| | | |
| | | /** |
| | | * num |
| | | */ |
| | | private Integer num; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月25日 16:36 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_PREDICT_MODEL") |
| | | public class MmPredictModelEntity implements Serializable { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | private String modelno; |
| | | |
| | | /** |
| | | * 模型名称 |
| | | */ |
| | | @NotBlank(message="模型名称不能为空") |
| | | private String modelname; |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String itemid; |
| | | |
| | | /** |
| | | * arithid |
| | | */ |
| | | private String arithid; |
| | | |
| | | /** |
| | | * trainsamplength |
| | | */ |
| | | private BigDecimal trainsamplength; |
| | | |
| | | /** |
| | | * predictsamplength |
| | | */ |
| | | private BigDecimal predictsamplength; |
| | | |
| | | /** |
| | | * isonlinetrain |
| | | */ |
| | | private BigDecimal isonlinetrain; |
| | | |
| | | /** |
| | | * 模型路径 |
| | | */ |
| | | @NotBlank(message="模型路径不能为空") |
| | | private String modelpath; |
| | | |
| | | /** |
| | | * isnormal |
| | | */ |
| | | private BigDecimal isnormal; |
| | | |
| | | /** |
| | | * normalmax |
| | | */ |
| | | private BigDecimal normalmax; |
| | | |
| | | /** |
| | | * normalmin |
| | | */ |
| | | private BigDecimal normalmin; |
| | | |
| | | /** |
| | | * status |
| | | */ |
| | | private BigDecimal status; |
| | | |
| | | /** |
| | | * 类名 |
| | | */ |
| | | @NotBlank(message="类名不能为空") |
| | | private String classname; |
| | | |
| | | /** |
| | | * 方法名 |
| | | */ |
| | | @NotBlank(message="方法名不能为空") |
| | | private String methodname; |
| | | |
| | | /** |
| | | * 参数 |
| | | */ |
| | | @NotBlank(message="参数不能为空") |
| | | private String modelparamstructure; |
| | | |
| | | /** |
| | | * 结果 |
| | | */ |
| | | @NotBlank(message="结果不能为空") |
| | | private String resultstrid; |
| | | |
| | | /** |
| | | * 模型设置 |
| | | */ |
| | | private String settingmap; |
| | | |
| | | /** |
| | | * 训练模型路径 |
| | | */ |
| | | private String trainmodelpath; |
| | | |
| | | /** |
| | | * 路径状态 |
| | | */ |
| | | private BigDecimal pathstatus; |
| | | |
| | | /** |
| | | * 预测阶段需要输入的数据长度 |
| | | */ |
| | | private Integer pdim; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 16:16 |
| | | */ |
| | | @Data |
| | | @TableName("T_MM_RESULT_TABLE") |
| | | public class MmResultTableEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 表名 |
| | | */ |
| | | @NotBlank(message="表名不能为空") |
| | | private String tablename; |
| | | } |
对比新文件 |
| | |
| | | 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 javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月06日 12:00 |
| | | */ |
| | | @Data |
| | | @TableName("T_SEQUENCE_NUM") |
| | | public class SequenceNumEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @NotBlank(message="编号不能为空") |
| | | private String code; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @NotBlank(message="名称不能为空") |
| | | private String name; |
| | | |
| | | /** |
| | | * 序号 |
| | | */ |
| | | @NotBlank(message="序号不能为空") |
| | | private Integer sequenceNum; |
| | | |
| | | /** |
| | | * 前缀 |
| | | */ |
| | | private String prefix; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.enums; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年01月02日 16:19:00 |
| | | */ |
| | | public enum ItemIncreaseCodeEnum { |
| | | PRE_MDL, CM, IC, IM |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.enums; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月01日 |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ItemStatus { |
| | | STATUS0(0, "禁用"), |
| | | STATUS1(0, "启用"); |
| | | |
| | | private Integer code; |
| | | private String desc; |
| | | |
| | | public static ItemStatus getEumByCode(Integer code) { |
| | | if (code == null) { |
| | | return null; |
| | | } |
| | | |
| | | for (ItemStatus statusEnum : ItemStatus.values()) { |
| | | if (statusEnum.getCode().equals(code)) { |
| | | return statusEnum; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.enums; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 17:20 |
| | | */ |
| | | public enum ItemTypeEnum { |
| | | |
| | | NORMAL_ITEM("NormalItem"),MERGE_ITEM("MergeItem"),STEAMSP_ITEM("SteamSpItem"); |
| | | |
| | | private String name; |
| | | |
| | | ItemTypeEnum(String name){ |
| | | this.name = name; |
| | | } |
| | | |
| | | public String getName() { |
| | | return name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleItemEntity; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:11 |
| | | */ |
| | | public interface DmModuleItemService extends BaseService<DmModuleItemEntity> { |
| | | |
| | | void saveModuleItem(DmModuleItemEntity moduleItem); |
| | | |
| | | void update(DmModuleItemEntity moduleItem); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.DmModulePageReqVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 8:35 |
| | | */ |
| | | public interface DmModuleService extends BaseService<DmModuleEntity> { |
| | | |
| | | void saveModule(DmModuleEntity module); |
| | | |
| | | void update(DmModuleEntity module); |
| | | |
| | | void deleteBatch(String[] module); |
| | | |
| | | int check(DmModuleEntity module); |
| | | |
| | | PageResult<DmModuleEntity> queryPage(DmModulePageReqVO reqVO); |
| | | |
| | | List<DmModuleEntity> list(Map<String, Object> params); |
| | | |
| | | List<DmModuleEntity> getModuleByModuleType(String moduletype); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.dto.MmItemOutputDTO; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:13 |
| | | */ |
| | | public interface MmItemOutputService extends BaseService<MmItemOutputEntity> { |
| | | |
| | | void saveMmItemOutput(MmItemOutputEntity mmItemOutput); |
| | | |
| | | void update(MmItemOutputEntity mmItemOutput); |
| | | |
| | | List<MmItemOutputDTO> queryList(Map<String, Object> params); |
| | | |
| | | MmItemOutputVO getOutPutById(String outputid); |
| | | |
| | | List<MmItemOutputVO> getOutPutByItemId(String itemid); |
| | | |
| | | List<MmItemOutputVO> getOutPutByPointId(String pointid); |
| | | |
| | | MmItemOutputEntity getByItemid(String itemid); |
| | | } |
对比新文件 |
| | |
| | | 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; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月28日 10:34 |
| | | */ |
| | | public interface MmItemResultService { |
| | | |
| | | List<MmItemResultEntity> getListByOutputId(String outputid, Map<String, Object> params); |
| | | |
| | | void savePredictValue(Map<String, List<DataValueVO>> predictValueMap, int t, String nIndex, Date predictTime); |
| | | |
| | | List<DataValueVO> getPredictValue(String outputid, Date startTime, Date endTime); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 15:27 |
| | | */ |
| | | public interface MmItemTypeService extends BaseService<MmItemTypeEntity> { |
| | | |
| | | void saveItemType(MmItemTypeEntity module); |
| | | |
| | | void update(MmItemTypeEntity module); |
| | | |
| | | void deleteBatch(String[] module); |
| | | |
| | | int check(MmItemTypeEntity module); |
| | | |
| | | PageResult<MmItemTypeEntity> page(MmItemTypePageReqVO reqVO); |
| | | |
| | | MmItemTypeEntity getItemTypeByItemId(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.MmModelArithSettingsEntity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:06 |
| | | */ |
| | | public interface MmModelArithSettingsService extends BaseService<MmModelArithSettingsEntity> { |
| | | |
| | | void saveList(List<MmModelArithSettingsEntity> list); |
| | | |
| | | List<MmModelArithSettingsEntity> getByModelId(String modelId); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:09 |
| | | */ |
| | | public interface MmModelParamService extends BaseService<MmModelParamEntity> { |
| | | |
| | | void saveList(List<MmModelParamEntity> list); |
| | | |
| | | List<MmModelParamEntity> getByModelid(String modelid); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelResultstrEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.MmModelResultstrPageReqVO; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月07日 16:42 |
| | | */ |
| | | public interface MmModelResultstrService extends BaseService<MmModelResultstrEntity> { |
| | | |
| | | PageResult<MmModelResultstrEntity> page(MmModelResultstrPageReqVO reqVO); |
| | | |
| | | MmModelResultstrEntity getInfo(String id); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictItemEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.MergeItemVO; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 13:57 |
| | | */ |
| | | public interface MmPredictItemService extends BaseService<MmPredictItemEntity> { |
| | | |
| | | void savePredictItem(MmPredictItemDTO mmPredictItemDto); |
| | | |
| | | void update(MmPredictItemDTO mmPredictItemDto); |
| | | |
| | | void deleteBatch(String[] itemIds); |
| | | |
| | | MmPredictItemDTO getDetailById(String id, Map<String, Object> params); |
| | | |
| | | boolean exportItemResult(HttpServletResponse response, HttpServletRequest request, String id, Map<String, Object> params); |
| | | |
| | | int check(MmPredictItemEntity mmPredictItem); |
| | | |
| | | PageResult<MmPredictItemRespVO> getPageList(Map<String, Object> params); |
| | | |
| | | Long count(); |
| | | |
| | | List<ItemVO> getByModuleId(String moduleId); |
| | | |
| | | ItemVO getItemByItemNo(String itemNo); |
| | | |
| | | ItemVO getItemById(String itemId); |
| | | |
| | | MergeItemVO getMergeItemByItemId(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.MmPredictMergeItemEntity; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:00 |
| | | */ |
| | | public interface MmPredictMergeItemService extends BaseService<MmPredictMergeItemEntity> { |
| | | |
| | | void savePredictMergeItem(MmPredictMergeItemEntity resultTable); |
| | | |
| | | void update(MmPredictMergeItemEntity resultTable); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 11:26 |
| | | */ |
| | | public interface MmPredictModelService extends BaseService<MmPredictModelEntity> { |
| | | |
| | | void savePredictModel(MmPredictModelEntity predictModel); |
| | | |
| | | void update(MmPredictModelEntity predictModel); |
| | | |
| | | MmPredictModelEntity getInfo(String id); |
| | | |
| | | BigDecimal getSampleLength(String id); |
| | | |
| | | List<MmPredictModelEntity> getNoSettingmapPredictModel(Map<String, Object> params); |
| | | |
| | | List<MmPredictModelEntity> getActiveModelByItemId(String itemId); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; |
| | | import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 16:25 |
| | | */ |
| | | public interface MmResultTableService extends BaseService<MmResultTableEntity> { |
| | | void saveResultTable(MmResultTableEntity resultTable); |
| | | |
| | | void update(MmResultTableEntity resultTable); |
| | | |
| | | void deleteBatch(String[] resultTableIds); |
| | | |
| | | int check(MmResultTableEntity resultTable); |
| | | |
| | | PageResult<MmResultTableEntity> page(MmResultTablePageReqVO reqVO); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.iailab.module.model.mcs.pre.entity.SequenceNumEntity; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月06日 13:15 |
| | | */ |
| | | public interface SequenceNumService extends IService<SequenceNumEntity> { |
| | | |
| | | SequenceNumEntity getAndIncreaseByCode(String code); |
| | | } |
对比新文件 |
| | |
| | | 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.module.model.mcs.pre.dao.DmModuleItemDao; |
| | | import com.iailab.module.model.mcs.pre.entity.DmModuleItemEntity; |
| | | import com.iailab.module.model.mcs.pre.service.DmModuleItemService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:20 |
| | | */ |
| | | @Service("dmModuleItemService") |
| | | public class DmModuleItemServiceImpl extends BaseServiceImpl<DmModuleItemDao, DmModuleItemEntity> implements DmModuleItemService { |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveModuleItem(DmModuleItemEntity moduleItem) { |
| | | moduleItem.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(moduleItem); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(DmModuleItemEntity moduleItem) { |
| | | baseDao.updateById(moduleItem); |
| | | } |
| | | |
| | | public DmModuleItemEntity getByItemid(String itemid) { |
| | | List<DmModuleItemEntity> list = baseDao.selectList(new QueryWrapper<DmModuleItemEntity>().in("itemid", itemid)); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new DmModuleItemEntity(); |
| | | } |
| | | return list.get(0); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.pre.dao.DmModuleDao; |
| | | 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.vo.DmModulePageReqVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 8:36 |
| | | */ |
| | | @Service("dmModuleService") |
| | | public class DmModuleServiceImpl extends BaseServiceImpl<DmModuleDao, DmModuleEntity> implements DmModuleService { |
| | | |
| | | @Override |
| | | public PageResult<DmModuleEntity> queryPage(DmModulePageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<DmModuleEntity> list(Map<String, Object> params) { |
| | | QueryWrapper<DmModuleEntity> wrapper = getWrapper(params); |
| | | wrapper.orderByDesc("CREATE_TIME"); |
| | | return baseDao.selectList(wrapper); |
| | | } |
| | | |
| | | private QueryWrapper<DmModuleEntity> getWrapper(Map<String, Object> params) { |
| | | String modulename = (String) params.get("modulename"); |
| | | String moduletype = (String) params.get("moduletype"); |
| | | |
| | | QueryWrapper<DmModuleEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(modulename), "modulename", modulename) |
| | | .eq(StringUtils.isNotBlank(moduletype), "moduletype", moduletype); |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveModule(DmModuleEntity module) { |
| | | module.setId(UUID.randomUUID().toString()); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | module.setPredicttime(calendar.getTime()); |
| | | module.setCollecttime(calendar.getTime()); |
| | | module.setUpdateTime(new Date()); |
| | | baseDao.insert(module); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(DmModuleEntity module) { |
| | | module.setUpdateTime(new Date()); |
| | | baseDao.updateById(module); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] moduleIds) { |
| | | baseDao.deleteBatchIds(Arrays.asList(moduleIds)); |
| | | } |
| | | |
| | | @Override |
| | | public List<DmModuleEntity> getModuleByModuleType(String moduletype) { |
| | | Map<String, Object> params = new HashMap<>(1); |
| | | params.put("moduletype", moduletype); |
| | | QueryWrapper<DmModuleEntity> wrapper = getWrapper(params); |
| | | return baseDao.selectList(wrapper); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public int check(DmModuleEntity module) { |
| | | String id = module.getId(); |
| | | String modulename = module.getModulename(); |
| | | QueryWrapper<DmModuleEntity> moduleWrapper = new QueryWrapper<>(); |
| | | moduleWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | moduleWrapper.and(wrapper -> wrapper.eq("modulename", modulename)); |
| | | |
| | | List<DmModuleEntity> list = baseDao.selectList(moduleWrapper); |
| | | return list.size(); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | 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.module.model.mcs.pre.dao.MmItemOutputDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.dto.MmItemOutputDTO; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:22 |
| | | */ |
| | | @Service("mmItemOutputService") |
| | | public class MmItemOutputServiceImpl extends BaseServiceImpl<MmItemOutputDao, MmItemOutputEntity> implements MmItemOutputService { |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveMmItemOutput(MmItemOutputEntity mmItemOutput) { |
| | | mmItemOutput.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(mmItemOutput); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MmItemOutputEntity mmItemOutput) { |
| | | this.updateById(mmItemOutput); |
| | | } |
| | | |
| | | public void deleteBatch(String[] itemIds) { |
| | | QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper<MmItemOutputEntity>(); |
| | | queryWrapper.in("itemid", itemIds); |
| | | baseDao.delete(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public MmItemOutputEntity getByItemid(String itemid) { |
| | | QueryWrapper<MmItemOutputEntity> queryWrapper = new QueryWrapper<MmItemOutputEntity>(); |
| | | queryWrapper.eq("itemid", itemid); |
| | | List<MmItemOutputEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new MmItemOutputEntity(); |
| | | } |
| | | return list.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public List<MmItemOutputDTO> queryList(Map<String, Object> params) { |
| | | return baseDao.queryList(params); |
| | | } |
| | | |
| | | @Override |
| | | public MmItemOutputVO getOutPutById(String outputid) { |
| | | List<MmItemOutputVO> list = baseDao.getOutPutById(outputid); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public List<MmItemOutputVO> getOutPutByItemId(String itemid) { |
| | | return baseDao.getOutPutByItemId(itemid); |
| | | } |
| | | |
| | | @Override |
| | | public List<MmItemOutputVO> getOutPutByPointId(String pointid) { |
| | | return baseDao.getOutPutByPointId(pointid); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | 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.data.api.point.dto.ApiPointDTO; |
| | | import com.iailab.module.model.mcs.pre.dao.MmItemResultDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemOutputEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemResultJsonEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemResultService; |
| | | import com.iailab.module.model.mdk.vo.DataValueVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月28日 10:34 |
| | | */ |
| | | @Service("mmItemResultService") |
| | | public class MmItemResultServiceImpl extends BaseServiceImpl<MmItemResultDao, MmItemResultEntity> |
| | | implements MmItemResultService { |
| | | |
| | | private final int max_group_count = 100; |
| | | |
| | | private final String T_MM_ITEM_RESULT = "T_MM_ITEM_RESULT"; |
| | | |
| | | @Autowired |
| | | private MmItemOutputService mmItemOutputService; |
| | | |
| | | @Override |
| | | public List<MmItemResultEntity> getListByOutputId(String outputid, Map<String, Object> params) { |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date startDateParam = null; |
| | | try { |
| | | startDateParam = sdf.parse((String)params.get("startTime")); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Date endDateParam = null; |
| | | try { |
| | | endDateParam = sdf.parse((String)params.get("endTime")); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | List<MmItemResultEntity> list = baseDao.selectList( |
| | | new QueryWrapper<MmItemResultEntity>() |
| | | .eq("outputid", outputid) |
| | | .between("datatime", startDateParam, endDateParam) |
| | | .orderByAsc("datatime") |
| | | ); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | 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(); |
| | | importData.setId(String.valueOf(UUID.randomUUID())); |
| | | importData.setOutputid(entry.getKey()); |
| | | importData.setDatatime(dataVo.getDataTime()); |
| | | importData.setDatavalue(new BigDecimal(dataVo.getDataValue())); |
| | | importList.add(importData); |
| | | } |
| | | |
| | | List<DataValueVO> lastVoList = new ArrayList<>(); |
| | | int size = entry.getValue().size(); |
| | | t = t > 0 ? t : 0; |
| | | int n = "n".equals(nIndex) ? size : Integer.parseInt(nIndex); |
| | | int length = (n - t) > 0 ? (n - t) : 0; //预测完不变的数据长度 |
| | | if (size >= n) { |
| | | for (int i = 0; i < (size - length); i ++) { |
| | | int index = length + i; |
| | | lastVoList.add(entry.getValue().get(index)); |
| | | } |
| | | } else { |
| | | lastVoList = entry.getValue(); |
| | | } |
| | | |
| | | for (DataValueVO dataVo : lastVoList) { |
| | | MmItemResultEntity importData = new MmItemResultEntity(); |
| | | importData.setId(String.valueOf(UUID.randomUUID())); |
| | | importData.setOutputid(entry.getKey()); |
| | | importData.setDatatime(dataVo.getDataTime()); |
| | | importData.setDatavalue(new BigDecimal(dataVo.getDataValue())); |
| | | lastList.add(importData); |
| | | } |
| | | |
| | | MmItemResultJsonEntity resultJson = new MmItemResultJsonEntity(); |
| | | resultJson.setId(UUID.randomUUID().toString()); |
| | | resultJson.setOutputid(entry.getKey()); |
| | | resultJson.setPredicttime(predictTime); |
| | | resultJson.setJsonvalue(JSONArray.toJSONString(entry.getValue())); |
| | | Map<String, Object> map4 = new HashMap(2); |
| | | map4.put("TABLENAME", "T_MM_ITEM_RESULT_JSON"); |
| | | map4.put("entity", resultJson); |
| | | baseDao.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()); |
| | | baseDao.deletePredictValue(params); |
| | | |
| | | int num1 = importList.size() / max_group_count; |
| | | int num2 = importList.size() % max_group_count; |
| | | if (num2 != 0) { |
| | | num1++; |
| | | } |
| | | |
| | | 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); |
| | | baseDao.savePredictValue(map2); |
| | | } |
| | | |
| | | Map<String, Object> map3 = new HashMap<>(2); |
| | | map3.put("TABLENAME", "T_MM_ITEM_RESULT_LAST_POINT"); |
| | | map3.put("list", lastList); |
| | | baseDao.savePredictValue(map3); |
| | | } |
| | | |
| | | @Override |
| | | public List<DataValueVO> getPredictValue(String outputid, Date startTime, Date endTime) { |
| | | List<DataValueVO> result = new ArrayList<>(); |
| | | QueryWrapper<MmItemResultEntity> queryWrapper = new QueryWrapper<MmItemResultEntity>() |
| | | .eq("outputid", outputid) |
| | | .between("datatime", startTime, endTime) |
| | | .orderByAsc("datatime"); |
| | | List<MmItemResultEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return result; |
| | | } |
| | | result = list.stream().map(t -> { |
| | | DataValueVO dv = new DataValueVO(); |
| | | dv.setDataTime(t.getDatatime()); |
| | | dv.setDataValue(t.getDatavalue().doubleValue()); |
| | | return dv; |
| | | }).collect(Collectors.toList()); |
| | | return result; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.collection.CollectionUtils; |
| | | import com.iailab.module.model.mcs.pre.dao.MmItemTypeDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemTypeService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemTypePageReqVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 15:29 |
| | | */ |
| | | @Service("mmItemTypeService") |
| | | public class MmItemTypeImpl extends BaseServiceImpl<MmItemTypeDao, MmItemTypeEntity> implements MmItemTypeService { |
| | | |
| | | @Override |
| | | public PageResult<MmItemTypeEntity> page(MmItemTypePageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | private QueryWrapper<MmItemTypeEntity> getWrapper(Map<String, Object> params) { |
| | | String itemtypename = (String)params.get("itemtypename"); |
| | | |
| | | QueryWrapper<MmItemTypeEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(itemtypename),"itemtypename", itemtypename); |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveItemType(MmItemTypeEntity itemType) { |
| | | itemType.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(itemType); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MmItemTypeEntity itemType) { |
| | | baseDao.updateById(itemType); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] moduleIds) { |
| | | baseDao.deleteBatchIds(Arrays.asList(moduleIds)); |
| | | } |
| | | |
| | | @Override |
| | | public int check(MmItemTypeEntity itemType) { |
| | | String id = itemType.getId(); |
| | | String itemtypename = itemType.getItemtypename(); |
| | | QueryWrapper<MmItemTypeEntity> moduleWrapper = new QueryWrapper<>(); |
| | | moduleWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | moduleWrapper.and(wrapper -> wrapper.eq("itemtypename",itemtypename)); |
| | | List<MmItemTypeEntity> list = baseDao.selectList(moduleWrapper); |
| | | return list.size(); |
| | | } |
| | | |
| | | public MmItemTypeEntity getById(String itemtypeid) { |
| | | MmItemTypeEntity entity = baseDao.selectById(itemtypeid); |
| | | return entity; |
| | | } |
| | | |
| | | @Override |
| | | public MmItemTypeEntity getItemTypeByItemId(String itemId) { |
| | | List<MmItemTypeEntity> list = baseDao.getItemTypeByItemId(itemId); |
| | | if (CollectionUtils.isAnyEmpty(list)) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | 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.module.model.mcs.pre.dao.MmModelArithSettingsDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:24 |
| | | */ |
| | | @Service |
| | | public class MmModelArithSettingsServiceImpl extends BaseServiceImpl<MmModelArithSettingsDao, MmModelArithSettingsEntity> |
| | | implements MmModelArithSettingsService { |
| | | |
| | | @Override |
| | | public void saveList(List<MmModelArithSettingsEntity> list) { |
| | | QueryWrapper<MmModelArithSettingsEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", list.get(0).getModelid()); |
| | | baseDao.delete(queryWrapper); |
| | | list.forEach(item -> { |
| | | item.setId(UUID.randomUUID().toString()); |
| | | }); |
| | | baseDao.insertList(list); |
| | | } |
| | | |
| | | public List<MmModelArithSettingsEntity> getByModelid(String modelid) { |
| | | Map<String, Object> params = new HashMap<>(1); |
| | | params.put("modelid", modelid); |
| | | List<MmModelArithSettingsEntity> list = baseDao.getMmModelArithSettings(params); |
| | | |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<MmModelArithSettingsEntity> getByModelId(String modelId) { |
| | | QueryWrapper<MmModelArithSettingsEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", modelId); |
| | | return baseDao.selectList(queryWrapper); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | 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.module.model.mcs.pre.dao.MmModelParamDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelParamService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:25 |
| | | */ |
| | | @Service("mmModelParamService") |
| | | public class MmModelParamServiceImpl extends BaseServiceImpl<MmModelParamDao, MmModelParamEntity> implements MmModelParamService { |
| | | |
| | | @Override |
| | | public void saveList(List<MmModelParamEntity> list) { |
| | | QueryWrapper<MmModelParamEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", list.get(0).getModelid()); |
| | | baseDao.delete(queryWrapper); |
| | | list.forEach(item -> { |
| | | item.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(item); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public List<MmModelParamEntity> getByModelid(String modelid) { |
| | | QueryWrapper<MmModelParamEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", modelid); |
| | | queryWrapper.orderByAsc("MODELPARAMPORTORDER"); |
| | | queryWrapper.orderByAsc("MODELPARAMORDER"); |
| | | List<MmModelParamEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return list; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.pre.dao.MmModelResultstrDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelResultstrEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelResultstrService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmModelResultstrPageReqVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月07日 16:43 |
| | | */ |
| | | @Service("mmModelResultstrService") |
| | | public class MmModelResultstrServiceImpl extends BaseServiceImpl<MmModelResultstrDao, MmModelResultstrEntity> |
| | | implements MmModelResultstrService { |
| | | |
| | | @Override |
| | | public PageResult<MmModelResultstrEntity> page(MmModelResultstrPageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | public MmModelResultstrEntity getInfo(String id) { |
| | | return baseDao.selectById(id); |
| | | |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | 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.*; |
| | | import com.iailab.module.model.mcs.pre.enums.ItemIncreaseCodeEnum; |
| | | import com.iailab.module.model.mcs.pre.enums.ItemTypeEnum; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | | import com.iailab.module.model.mcs.pre.service.SequenceNumService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.MergeItemVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 14:03 |
| | | */ |
| | | @Service("mmPredictItemService") |
| | | public class MmPredictItemServiceImpl extends BaseServiceImpl<MmPredictItemDao, MmPredictItemEntity> implements MmPredictItemService { |
| | | |
| | | @Autowired |
| | | private DmModuleItemServiceImpl dmModuleItemService; |
| | | |
| | | @Autowired |
| | | private MmItemOutputServiceImpl mmItemOutputService; |
| | | |
| | | @Autowired |
| | | private MmPredictModelServiceImpl mmPredictModelService; |
| | | |
| | | @Autowired |
| | | private MmModelArithSettingsServiceImpl mmModelArithSettingsService; |
| | | |
| | | @Autowired |
| | | private MmModelParamServiceImpl mmModelParamService; |
| | | |
| | | @Autowired |
| | | private MmPredictMergeItemServiceImpl mmPredictMergeItemService; |
| | | |
| | | @Autowired |
| | | private MmItemTypeImpl mmItemTypeImpl; |
| | | |
| | | @Autowired |
| | | private SequenceNumService sequenceNumService; |
| | | |
| | | @Override |
| | | public PageResult<MmPredictItemRespVO> getPageList(Map<String, Object> params) { |
| | | PageResult<MmPredictItemRespVO> result = new PageResult(); |
| | | IPage<MmPredictItemRespVO> page = baseDao.getPageList( |
| | | getPage(params, "CREATE_TIME", false), |
| | | params |
| | | ); |
| | | result.setList(page.getRecords()); |
| | | result.setTotal(page.getTotal()); |
| | | return result; |
| | | } |
| | | |
| | | private QueryWrapper<MmPredictItemEntity> getWrapper(Map<String, Object> params) { |
| | | QueryWrapper<MmPredictItemEntity> wrapper = new QueryWrapper<>(); |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePredictItem(MmPredictItemDTO mmPredictItemDto) { |
| | | MmPredictItemEntity predictItem = mmPredictItemDto.getMmPredictItem(); |
| | | predictItem.setId(UUID.randomUUID().toString()); |
| | | predictItem.setCreateTime(new Date()); |
| | | predictItem.setUpdateTime(new Date()); |
| | | |
| | | MmItemTypeEntity itemType = mmItemTypeImpl.getById(predictItem.getItemtypeid()); |
| | | if (ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | SequenceNumEntity sequenceNumEntity = sequenceNumService.getAndIncreaseByCode(ItemIncreaseCodeEnum.IM.toString()); |
| | | String str = String.format("%010d", sequenceNumEntity.getSequenceNum()); |
| | | predictItem.setItemno(sequenceNumEntity.getPrefix() + str); |
| | | |
| | | MmPredictModelEntity mmPredictModel = mmPredictItemDto.getMmPredictModel(); |
| | | SequenceNumEntity preMdlSequenceNumEntity = sequenceNumService.getAndIncreaseByCode(ItemIncreaseCodeEnum.PRE_MDL.toString()); |
| | | String preMdlStr = String.format("%04d", preMdlSequenceNumEntity.getSequenceNum()); |
| | | mmPredictModel.setModelno(preMdlSequenceNumEntity.getPrefix() + preMdlStr); |
| | | mmPredictModel.setItemid(predictItem.getId()); |
| | | mmPredictModelService.savePredictModel(mmPredictModel); |
| | | |
| | | List<MmModelArithSettingsEntity> mmModelArithSettingsList = mmPredictItemDto.getMmModelArithSettingsList(); |
| | | mmModelArithSettingsList.forEach(item -> { |
| | | item.setModelid(mmPredictModel.getId()); |
| | | }); |
| | | mmModelArithSettingsService.saveList(mmModelArithSettingsList); |
| | | |
| | | List<MmModelParamEntity> mmModelParamList = mmPredictItemDto.getMmModelParamList(); |
| | | mmModelParamList.forEach(item -> { |
| | | item.setModelid(mmPredictModel.getId()); |
| | | }); |
| | | mmModelParamService.saveList(mmModelParamList); |
| | | } else if (ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | SequenceNumEntity sequenceNumEntity = sequenceNumService.getAndIncreaseByCode(ItemIncreaseCodeEnum.IC.toString()); |
| | | String str = String.format("%010d", sequenceNumEntity.getSequenceNum()); |
| | | predictItem.setItemno(sequenceNumEntity.getPrefix() + str); |
| | | |
| | | MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem(); |
| | | mMmPredictMergeItem.setItemid(predictItem.getId()); |
| | | mmPredictMergeItemService.savePredictMergeItem(mMmPredictMergeItem); |
| | | } |
| | | insert(predictItem); |
| | | DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem(); |
| | | dmModuleItem.setItemid(predictItem.getId()); |
| | | dmModuleItemService.saveModuleItem(dmModuleItem); |
| | | |
| | | MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput(); |
| | | mmItemOutput.setItemid(predictItem.getId()); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MmPredictItemDTO mmPredictItemDto) { |
| | | MmPredictItemEntity predictItem = mmPredictItemDto.getMmPredictItem(); |
| | | predictItem.setUpdateTime(new Date()); |
| | | this.updateById(predictItem); |
| | | MmItemTypeEntity itemType = mmItemTypeImpl.getById(predictItem.getItemtypeid()); |
| | | if (ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | MmPredictModelEntity mmPredictModel = mmPredictItemDto.getMmPredictModel(); |
| | | mmPredictModelService.update(mmPredictModel); |
| | | |
| | | List<MmModelArithSettingsEntity> mmModelArithSettingsList = mmPredictItemDto.getMmModelArithSettingsList(); |
| | | mmModelArithSettingsList.forEach(item -> { |
| | | item.setModelid(mmPredictModel.getId()); |
| | | }); |
| | | mmModelArithSettingsService.saveList(mmModelArithSettingsList); |
| | | |
| | | List<MmModelParamEntity> mmModelParamList = mmPredictItemDto.getMmModelParamList(); |
| | | mmModelParamList.forEach(item -> { |
| | | item.setModelid(mmPredictModel.getId()); |
| | | }); |
| | | mmModelParamService.saveList(mmModelParamList); |
| | | } else if (ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | MmPredictMergeItemEntity mMmPredictMergeItem = mmPredictItemDto.getMmPredictMergeItem(); |
| | | mmPredictMergeItemService.update(mMmPredictMergeItem); |
| | | } |
| | | DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem(); |
| | | dmModuleItemService.update(dmModuleItem); |
| | | |
| | | MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput(); |
| | | mmItemOutputService.update(mmItemOutput); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] itemIds) { |
| | | deleteBatchIds(Arrays.asList(itemIds)); |
| | | mmPredictMergeItemService.deleteBatch(itemIds); |
| | | mmPredictModelService.deleteBatch(itemIds); |
| | | mmItemOutputService.deleteBatch(itemIds); |
| | | } |
| | | |
| | | @Override |
| | | public MmPredictItemDTO getDetailById(String id, Map<String, Object> params) { |
| | | MmPredictItemDTO mmPredictItemDto = new MmPredictItemDTO(); |
| | | MmPredictItemEntity predictItem = selectById(id); |
| | | mmPredictItemDto.setMmPredictItem(predictItem); |
| | | mmPredictItemDto.setDmModuleItem(dmModuleItemService.getByItemid(id)); |
| | | mmPredictItemDto.setMmItemOutput(mmItemOutputService.getByItemid(id)); |
| | | MmItemTypeEntity itemType = mmItemTypeImpl.getById(predictItem.getItemtypeid()); |
| | | if (ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | MmPredictModelEntity mmPredictModel = mmPredictModelService.getByItemid(id); |
| | | mmPredictItemDto.setMmPredictModel(mmPredictModel); |
| | | mmPredictItemDto.setMmModelArithSettingsList(mmModelArithSettingsService.getByModelid(mmPredictModel.getId())); |
| | | mmPredictItemDto.setMmModelParamList(mmModelParamService.getByModelid(mmPredictModel.getId())); |
| | | } else if (ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | mmPredictItemDto.setMmPredictMergeItem(mmPredictMergeItemService.getByItemid(id)); |
| | | } |
| | | |
| | | return mmPredictItemDto; |
| | | } |
| | | |
| | | @Override |
| | | public boolean exportItemResult(HttpServletResponse response, HttpServletRequest request, String id, Map<String, Object> params) { |
| | | //MmPredictItemDTO mmPredictItemDto = this.getPredictValuesById(id, params); |
| | | //List<MmItemResultEntity> itemResultList = mmPredictItemDto.getMmItemResultList(); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public int check(MmPredictItemEntity mmPredictItem) { |
| | | String id = mmPredictItem.getId(); |
| | | String itemname = mmPredictItem.getItemname(); |
| | | String itemno = mmPredictItem.getItemno(); |
| | | QueryWrapper<MmPredictItemEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | queryWrapper.and(wrapper -> wrapper.eq("itemname", itemname).or().eq("itemno", itemno)); |
| | | List<MmPredictItemEntity> list = baseDao.selectList(queryWrapper); |
| | | return list.size(); |
| | | } |
| | | |
| | | @Override |
| | | public Long count() { |
| | | QueryWrapper<MmPredictItemEntity> queryWrapper = new QueryWrapper<>(); |
| | | return baseDao.selectCount(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<ItemVO> getByModuleId(String moduleId) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | |
| | | return baseDao.getByModuleId(params); |
| | | } |
| | | |
| | | @Override |
| | | public ItemVO getItemByItemNo(String itemNo) { |
| | | if (StringUtils.isBlank(itemNo)) { |
| | | return null; |
| | | } |
| | | Map<String, Object> params = new HashMap(1); |
| | | params.put("ITEMNO", itemNo); |
| | | List<ItemVO> list = baseDao.getItem(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public ItemVO getItemById(String itemId) { |
| | | if (StringUtils.isBlank(itemId)) { |
| | | return null; |
| | | } |
| | | Map<String, Object> params = new HashMap(1); |
| | | params.put("ITEMID", itemId); |
| | | List<ItemVO> list = baseDao.getItem(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public MergeItemVO getMergeItemByItemId(String itemId) { |
| | | if (StringUtils.isBlank(itemId)) { |
| | | return null; |
| | | } |
| | | Map<String, Object> params = new HashMap(1); |
| | | params.put("ITEMID", itemId); |
| | | List<MergeItemVO> list = baseDao.getMergeItemByItemId(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | 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.module.model.mcs.pre.dao.MmPredictMergeItemDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictMergeItemEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictMergeItemService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 9:27 |
| | | */ |
| | | @Service("mmPredictMergeItemService") |
| | | public class MmPredictMergeItemServiceImpl extends BaseServiceImpl<MmPredictMergeItemDao, MmPredictMergeItemEntity> implements MmPredictMergeItemService { |
| | | |
| | | @Override |
| | | public void savePredictMergeItem(MmPredictMergeItemEntity predictMergeItem) { |
| | | predictMergeItem.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(predictMergeItem); |
| | | } |
| | | |
| | | @Override |
| | | public void update(MmPredictMergeItemEntity predictMergeItem) { |
| | | this.updateById(predictMergeItem); |
| | | } |
| | | |
| | | public void deleteBatch(String[] itemIds) { |
| | | QueryWrapper queryWrapper = new QueryWrapper<MmPredictMergeItemEntity>(); |
| | | queryWrapper.in("itemid", itemIds); |
| | | baseDao.delete(queryWrapper); |
| | | } |
| | | |
| | | public MmPredictMergeItemEntity getByItemid(String itemid) { |
| | | QueryWrapper queryWrapper = new QueryWrapper<MmPredictMergeItemEntity>(); |
| | | queryWrapper.eq("itemid", itemid); |
| | | List<MmPredictMergeItemEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new MmPredictMergeItemEntity(); |
| | | } |
| | | return list.get(0); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | 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.module.model.mcs.pre.dao.MmPredictModelDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictModelService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月27日 11:30 |
| | | */ |
| | | @Service("mmPredictModelService") |
| | | public class MmPredictModelServiceImpl extends BaseServiceImpl<MmPredictModelDao, MmPredictModelEntity> implements MmPredictModelService { |
| | | |
| | | @Override |
| | | public void savePredictModel(MmPredictModelEntity predictModel) { |
| | | predictModel.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(predictModel); |
| | | } |
| | | |
| | | @Override |
| | | public void update(MmPredictModelEntity predictModel) { |
| | | this.updateById(predictModel); |
| | | } |
| | | |
| | | @Override |
| | | public MmPredictModelEntity getInfo(String id) { |
| | | return baseDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getSampleLength(String id) { |
| | | BigDecimal result = BigDecimal.ZERO; |
| | | List<MmPredictModelEntity> list = baseDao.getSampleLength(id); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return result; |
| | | } |
| | | result = list.get(0).getPredictsamplength(); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public void deleteBatch(String[] itemIds) { |
| | | QueryWrapper<MmPredictModelEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.in("itemid", itemIds); |
| | | baseDao.delete(queryWrapper); |
| | | } |
| | | |
| | | public MmPredictModelEntity getByItemid(String itemid) { |
| | | QueryWrapper<MmPredictModelEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("itemid", itemid); |
| | | List<MmPredictModelEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new MmPredictModelEntity(); |
| | | } |
| | | return list.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public List<MmPredictModelEntity> getNoSettingmapPredictModel(Map<String, Object> params) { |
| | | return baseDao.getNoSettingmapPredictModel(params); |
| | | } |
| | | |
| | | @Override |
| | | public List<MmPredictModelEntity> getActiveModelByItemId(String itemId) { |
| | | return baseDao.getActiveModelByItemId(itemId); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.pre.dao.MmResultTableDao; |
| | | import com.iailab.module.model.mcs.pre.entity.MmResultTableEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmResultTableService;; |
| | | import com.iailab.module.model.mcs.pre.vo.MmResultTablePageReqVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月23日 16:28 |
| | | */ |
| | | @Service("mmResultTableService") |
| | | public class MmResultTableServiceImpl extends BaseServiceImpl<MmResultTableDao, MmResultTableEntity> implements MmResultTableService { |
| | | @Override |
| | | public PageResult<MmResultTableEntity> page(MmResultTablePageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | private QueryWrapper<MmResultTableEntity> getWrapper(Map<String, Object> params) { |
| | | String tablename = (String)params.get("tablename"); |
| | | |
| | | QueryWrapper<MmResultTableEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(tablename),"tablename", tablename); |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveResultTable(MmResultTableEntity resultTable) { |
| | | resultTable.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(resultTable); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MmResultTableEntity resultTable) { |
| | | baseDao.updateById(resultTable); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] resultTableIds) { |
| | | baseDao.deleteBatchIds(Arrays.asList(resultTableIds)); |
| | | } |
| | | |
| | | @Override |
| | | public int check(MmResultTableEntity resultTable) { |
| | | String id = resultTable.getId(); |
| | | String tablename = resultTable.getTablename(); |
| | | QueryWrapper<MmResultTableEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | queryWrapper.and(wrapper -> wrapper.eq("tablename",tablename)); |
| | | |
| | | List<MmResultTableEntity> list = baseDao.selectList(queryWrapper); |
| | | return list.size(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.module.model.mcs.pre.dao.SequenceNumDao; |
| | | import com.iailab.module.model.mcs.pre.entity.SequenceNumEntity; |
| | | import com.iailab.module.model.mcs.pre.service.SequenceNumService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月06日 13:20 |
| | | */ |
| | | @Service("sequenceNumService") |
| | | public class SequenceNumServiceImpl extends ServiceImpl<SequenceNumDao, SequenceNumEntity> implements SequenceNumService { |
| | | |
| | | @Override |
| | | public synchronized SequenceNumEntity getAndIncreaseByCode (String code) { |
| | | QueryWrapper queryWrapper = new QueryWrapper<SequenceNumEntity>(); |
| | | queryWrapper.eq("code", code); |
| | | SequenceNumEntity sequenceNumEntity = this.getOne(queryWrapper); |
| | | |
| | | SequenceNumEntity sequenceNumUpdate = new SequenceNumEntity(); |
| | | sequenceNumUpdate.setId(sequenceNumEntity.getId()); |
| | | sequenceNumUpdate.setSequenceNum(sequenceNumEntity.getSequenceNum() + 1); |
| | | this.updateById(sequenceNumUpdate); |
| | | return sequenceNumEntity; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年05月10日 13:31 |
| | | */ |
| | | @Data |
| | | public class CountItemtypeVO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 预测项类型名 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | private Integer count; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月29日 |
| | | */ |
| | | @Schema(description = "模型平台 - 管网分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class DmModulePageReqVO extends PageParam { |
| | | |
| | | private String modulename; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月29日 |
| | | */ |
| | | @Schema(description = "模型平台 - ModBusDevice Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class DmModuleRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "名称") |
| | | @ExcelProperty("名称") |
| | | private String modulename; |
| | | |
| | | @Schema(description = "类型") |
| | | @ExcelProperty("类型") |
| | | private String moduletype; |
| | | |
| | | @Schema(description = "周期") |
| | | @ExcelProperty("周期") |
| | | private BigDecimal cycle; |
| | | |
| | | @Schema(description = "模块配置") |
| | | @ExcelProperty("模块配置") |
| | | private String modulenavconfig; |
| | | |
| | | @Schema(description = "预测时间") |
| | | @ExcelProperty("预测时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date predicttime; |
| | | |
| | | @Schema(description = "采集时间") |
| | | @ExcelProperty("采集时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") |
| | | private Date collecttime; |
| | | |
| | | @Schema(description = "创建时间") |
| | | @ExcelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @Schema(description = "更新时间") |
| | | @ExcelProperty("更新时间") |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MmItemOutputPageReqVO extends PageParam { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - MmItemOutput Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MmItemOutputRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "预测项ID") |
| | | @ExcelProperty("预测项ID") |
| | | private String itemid; |
| | | |
| | | @Schema(description = "数据点ID") |
| | | @ExcelProperty("数据点ID") |
| | | private String pointid; |
| | | |
| | | @Schema(description = "存放表ID") |
| | | @ExcelProperty("存放表ID") |
| | | private String resulttableid; |
| | | |
| | | @Schema(description = "数据点名称") |
| | | @ExcelProperty("数据点名称") |
| | | private String tagname; |
| | | |
| | | @Schema(description = "排序(默认值1)") |
| | | @ExcelProperty("排序") |
| | | private BigDecimal outputorder; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MmItemTypePageReqVO extends PageParam { |
| | | |
| | | private String itemtypename; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - MmItemType Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MmItemTypeRespVO { |
| | | |
| | | @Schema(description = "ID") |
| | | @ExcelProperty("ID") |
| | | private String id; |
| | | |
| | | @Schema(description = "名称") |
| | | @ExcelProperty("名称") |
| | | private String itemtypename; |
| | | |
| | | @Schema(description = "类名") |
| | | @ExcelProperty("类名") |
| | | private String itemclasstype; |
| | | |
| | | @Schema(description = "程序集") |
| | | @ExcelProperty("程序集") |
| | | private String assemblyname; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MmModelResultstrPageReqVO extends PageParam { |
| | | |
| | | private String resultstr; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - MmModelResultstr Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MmModelResultstrRespVO { |
| | | |
| | | @Schema(description = "主键") |
| | | @ExcelProperty("主键") |
| | | private String id; |
| | | |
| | | @Schema(description = "结果") |
| | | @ExcelProperty("结果") |
| | | private String resultstr; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MmPredictItemPageReqVO extends PageParam { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 13:27 |
| | | */ |
| | | @Schema(description = "模型平台 - MmPredictItem Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MmPredictItemRespVO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @Schema(description = "主键") |
| | | @ExcelProperty("主键") |
| | | private String id; |
| | | |
| | | @Schema(description = "编号") |
| | | @ExcelProperty("编号") |
| | | private String itemno; |
| | | |
| | | @Schema(description = "预测项名") |
| | | @ExcelProperty("预测项名") |
| | | private String itemname; |
| | | |
| | | @Schema(description = "类型ID") |
| | | @ExcelProperty("类型ID") |
| | | private String itemtypeid; |
| | | |
| | | @Schema(description = "类型名称") |
| | | @ExcelProperty("类型名称") |
| | | private String itemtypename; |
| | | |
| | | @Schema(description = "粒度") |
| | | @ExcelProperty("粒度") |
| | | private BigDecimal granularity; |
| | | |
| | | @Schema(description = "是否融合") |
| | | @ExcelProperty("是否融合") |
| | | private BigDecimal isfuse; |
| | | |
| | | @Schema(description = "是否检查") |
| | | @ExcelProperty("是否检查") |
| | | private BigDecimal workchecked; |
| | | |
| | | @Schema(description = "模块ID") |
| | | @ExcelProperty("模块ID") |
| | | private String moduleid; |
| | | |
| | | @Schema(description = "排序") |
| | | @ExcelProperty("排序") |
| | | private Integer itemorder; |
| | | |
| | | @Schema(description = "是否启用") |
| | | @ExcelProperty("是否启用") |
| | | private BigDecimal status; |
| | | |
| | | @Schema(description = "类别ID") |
| | | @ExcelProperty("类别ID") |
| | | private String categoryid; |
| | | |
| | | @Schema(description = "数据点ID") |
| | | @ExcelProperty("数据点ID") |
| | | private String pointid; |
| | | |
| | | @Schema(description = "数据点名称") |
| | | @ExcelProperty("数据点名称") |
| | | private String tagname; |
| | | |
| | | @Schema(description = "存放表ID") |
| | | @ExcelProperty("存放表ID") |
| | | private String resulttableid; |
| | | |
| | | @Schema(description = "存放表") |
| | | @ExcelProperty("存放表") |
| | | private String tablename; |
| | | } |
| | | |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MmResultTablePageReqVO extends PageParam { |
| | | |
| | | private String tablename; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.pre.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - MmResultTable Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MmResultTableRespVO { |
| | | |
| | | private String id; |
| | | |
| | | /** |
| | | * 表名 |
| | | */ |
| | | @NotBlank(message="表名不能为空") |
| | | private String tablename; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.controller; |
| | | |
| | | import com.iailab.framework.common.exception.ErrorCode; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleService; |
| | | import com.iailab.module.model.mcs.sche.vo.StSchedulePageReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 13:51 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sche/schedule") |
| | | public class StScheduleController { |
| | | @Autowired |
| | | private StScheduleService stScheduleService; |
| | | |
| | | /** |
| | | * 调度列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<StScheduleRespVO>> page(@Validated StSchedulePageReqVO reqVO) { |
| | | PageResult<StScheduleEntity> page = stScheduleService.page(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, StScheduleRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 调度信息 |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<StScheduleEntity> info(@PathVariable("id") String id){ |
| | | StScheduleEntity schedule = stScheduleService.selectById(id); |
| | | return success(schedule); |
| | | } |
| | | |
| | | /** |
| | | * 保存调度 |
| | | */ |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> save(@RequestBody StScheduleEntity schedule){ |
| | | int count = stScheduleService.check(schedule); |
| | | if (count > 0) { |
| | | ErrorCode errorCode = new ErrorCode(999, "名称重复"); |
| | | return error(errorCode); |
| | | } |
| | | stScheduleService.saveSchedule(schedule); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改调度 |
| | | */ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody StScheduleEntity schedule){ |
| | | stScheduleService.update(schedule); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除调度 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id){ |
| | | stScheduleService.deleteBatch(new String[]{id}); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.controller; |
| | | |
| | | import com.iailab.framework.common.exception.ErrorCode; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleEnergyTypeEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleEnergyTypeService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleEnergyTypePageReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleEnergyTypeRespVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 14:02 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sche/schedule-energy-type") |
| | | public class StScheduleEnergyTypeController { |
| | | @Autowired |
| | | private StScheduleEnergyTypeService stScheduleEnergyTypeService; |
| | | |
| | | /** |
| | | * 调度类型列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<StScheduleEnergyTypeRespVO>> page(@Validated StScheduleEnergyTypePageReqVO reqVO) { |
| | | PageResult<StScheduleEnergyTypeEntity> page = stScheduleEnergyTypeService.page(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, StScheduleEnergyTypeRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 调度能源类型信息 |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<StScheduleEnergyTypeEntity> info(@PathVariable("id") String id){ |
| | | StScheduleEnergyTypeEntity scheduleEnergyType = stScheduleEnergyTypeService.selectById(id); |
| | | return success(scheduleEnergyType); |
| | | } |
| | | |
| | | /** |
| | | * 保存调度能源类型 |
| | | */ |
| | | @PostMapping |
| | | public CommonResult<Boolean> save(@RequestBody StScheduleEnergyTypeEntity scheduleEnergyType){ |
| | | int count = stScheduleEnergyTypeService.check(scheduleEnergyType); |
| | | if (count > 0) { |
| | | ErrorCode errorCode = new ErrorCode(999, "名称重复"); |
| | | return error(errorCode); |
| | | } |
| | | stScheduleEnergyTypeService.saveScheduleEnergyType(scheduleEnergyType); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改调度能源类型 |
| | | */ |
| | | @PutMapping |
| | | public CommonResult<Boolean> update(@RequestBody StScheduleEnergyTypeEntity scheduleEnergyType){ |
| | | int count = stScheduleEnergyTypeService.check(scheduleEnergyType); |
| | | if (count > 0) { |
| | | ErrorCode errorCode = new ErrorCode(999, "名称重复"); |
| | | return error(errorCode); |
| | | } |
| | | stScheduleEnergyTypeService.update(scheduleEnergyType); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除调度能源类型 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id){ |
| | | stScheduleEnergyTypeService.deleteBatch(new String[]{id}); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.controller; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | import com.iailab.module.model.mcs.sche.dto.StScheduleModelDto; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleModelService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleModelRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 14:35 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sche/schedule-model") |
| | | public class StScheduleModelController { |
| | | |
| | | @Autowired |
| | | private StScheduleModelService stScheduleModelService; |
| | | |
| | | /** |
| | | * 调度模型类型列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<StScheduleModelRespVO>> page(@RequestParam Map<String, Object> params) { |
| | | PageResult<StScheduleModelRespVO> page = stScheduleModelService.getPageList(params); |
| | | |
| | | return success(BeanUtils.toBean(page, StScheduleModelRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 调度模型类型信息 |
| | | */ |
| | | @GetMapping("/get") |
| | | public CommonResult<StScheduleModelDto> info(@RequestParam("id") String id){ |
| | | StScheduleModelDto scheduleMode = stScheduleModelService.getDetailById(id); |
| | | return success(scheduleMode); |
| | | } |
| | | |
| | | /** |
| | | * 保存调度模型类型 |
| | | */ |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> save(@RequestBody StScheduleModelDto scheduleMode){ |
| | | StScheduleModelEntity stScheduleModelEntity = ConvertUtils.sourceToTarget(scheduleMode, StScheduleModelEntity.class); |
| | | int count = stScheduleModelService.check(stScheduleModelEntity); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | stScheduleModelService.saveStScheduleModel(scheduleMode); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改调度模型类型 |
| | | */ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody StScheduleModelDto scheduleMode){ |
| | | StScheduleModelEntity stScheduleModelEntity = ConvertUtils.sourceToTarget(scheduleMode, StScheduleModelEntity.class); |
| | | int count = stScheduleModelService.check(stScheduleModelEntity); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | stScheduleModelService.update(scheduleMode); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除调度模型类型 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id){ |
| | | stScheduleModelService.deleteBatch(new String[]{id}); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.controller; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleObjectEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleObjectService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleObjectPageReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleObjectRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月21日 8:50 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sche/schedule-object") |
| | | public class StScheduleObjectController { |
| | | @Autowired |
| | | private StScheduleObjectService stScheduleObjectService; |
| | | |
| | | /** |
| | | * 调度对象类型列表 |
| | | */ |
| | | @GetMapping("/page") |
| | | public CommonResult<PageResult<StScheduleObjectRespVO>> page(@Validated StScheduleObjectPageReqVO reqVO) { |
| | | PageResult<StScheduleObjectEntity> page = stScheduleObjectService.page(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, StScheduleObjectRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 调度对象类型信息 |
| | | */ |
| | | @GetMapping("/info/{id}") |
| | | public CommonResult<StScheduleObjectEntity> info(@PathVariable("id") String id) { |
| | | StScheduleObjectEntity scheduleObject = stScheduleObjectService.selectById(id); |
| | | return success(scheduleObject); |
| | | } |
| | | |
| | | /** |
| | | * 保存调度对象类型 |
| | | */ |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> save(@RequestBody StScheduleObjectEntity scheduleObject) { |
| | | int count = stScheduleObjectService.check(scheduleObject); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | stScheduleObjectService.saveStScheduleObject(scheduleObject); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改调度对象类型 |
| | | */ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody StScheduleObjectEntity scheduleObject) { |
| | | int count = stScheduleObjectService.check(scheduleObject); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | stScheduleObjectService.update(scheduleObject); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除调度对象类型 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | stScheduleObjectService.deleteBatch(new String[]{id}); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.controller; |
| | | |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleUserEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleUserService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleUserPageReqVO; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleUserRespVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.error; |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 15:34 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sche/schedule-user") |
| | | public class StScheduleUserController { |
| | | @Autowired |
| | | private StScheduleUserService stScheduleUserService; |
| | | |
| | | /** |
| | | * 调度用户类型列表 |
| | | */ |
| | | @GetMapping("/list") |
| | | public CommonResult<PageResult<StScheduleUserRespVO>> page(@Validated StScheduleUserPageReqVO reqVO) { |
| | | PageResult<StScheduleUserEntity> page = stScheduleUserService.page(reqVO); |
| | | |
| | | return success(BeanUtils.toBean(page, StScheduleUserRespVO.class)); |
| | | } |
| | | |
| | | /** |
| | | * 调度用户类型信息 |
| | | */ |
| | | @GetMapping("/get") |
| | | public CommonResult<StScheduleUserEntity> info(@RequestParam("id") String id) { |
| | | StScheduleUserEntity scheduleUser = stScheduleUserService.selectById(id); |
| | | return success(scheduleUser); |
| | | } |
| | | |
| | | /** |
| | | * 保存调度用户类型 |
| | | */ |
| | | @PostMapping("/create") |
| | | public CommonResult<Boolean> save(@RequestBody StScheduleUserEntity scheduleUser) { |
| | | int count = stScheduleUserService.check(scheduleUser); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | stScheduleUserService.saveScheduleUser(scheduleUser); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 修改调度用户类型 |
| | | */ |
| | | @PutMapping("/update") |
| | | public CommonResult<Boolean> update(@RequestBody StScheduleUserEntity scheduleUser) { |
| | | int count = stScheduleUserService.check(scheduleUser); |
| | | if (count > 0) { |
| | | return error(999, "名称或编号重复"); |
| | | } |
| | | stScheduleUserService.update(scheduleUser); |
| | | return success(true); |
| | | } |
| | | |
| | | /** |
| | | * 删除调度用户类型 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
| | | stScheduleUserService.deleteBatch(new String[]{id}); |
| | | return success(true); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StSchedulePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:54 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleDao extends BaseMapperX<StScheduleEntity> { |
| | | |
| | | |
| | | default PageResult<StScheduleEntity> selectPage(StSchedulePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<StScheduleEntity>() |
| | | .likeIfPresent(StScheduleEntity::getName, reqVO.getName()) |
| | | .orderByDesc(StScheduleEntity::getName)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleEnergyTypeEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleEnergyTypePageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:53 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleEnergyTypeDao extends BaseMapperX<StScheduleEnergyTypeEntity> { |
| | | |
| | | default PageResult<StScheduleEnergyTypeEntity> selectPage(StScheduleEnergyTypePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<StScheduleEnergyTypeEntity>() |
| | | .likeIfPresent(StScheduleEnergyTypeEntity::getEnergytypename, reqVO.getEnergytypename()) |
| | | .orderByDesc(StScheduleEnergyTypeEntity::getEnergytypename)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleModelRespVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:56 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleModelDao extends BaseMapperX<StScheduleModelEntity> { |
| | | |
| | | /** |
| | | * 查询列表 |
| | | * |
| | | * @param page |
| | | * @param params |
| | | * @return |
| | | */ |
| | | IPage<StScheduleModelRespVO> getPageList(IPage<StScheduleModelEntity> page, @Param("params") Map<String, Object> params); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelUserParamEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.ScheduleModelUserParamVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:58 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleModelUserParamDao extends BaseMapperX<StScheduleModelUserParamEntity> { |
| | | /** |
| | | * queryList |
| | | * |
| | | * @param page |
| | | * @param params |
| | | * @return |
| | | */ |
| | | IPage<ScheduleModelUserParamVo> queryList(IPage<ScheduleModelUserParamVo> page, @Param("params") Map<String, Object> params); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleObjectEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleObjectPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 8:44 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleObjectDao extends BaseMapperX<StScheduleObjectEntity> { |
| | | |
| | | default PageResult<StScheduleObjectEntity> selectPage(StScheduleObjectPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<StScheduleObjectEntity>() |
| | | .likeIfPresent(StScheduleObjectEntity::getName, reqVO.getName()) |
| | | .orderByDesc(StScheduleObjectEntity::getName)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 8:51 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleParamDao extends BaseMapperX<StScheduleParamEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamSettingEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 8:54 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleParamSettingDao extends BaseMapperX<StScheduleParamSettingEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 9:08 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleSchemeDao extends BaseMapperX<StScheduleSchemeEntity> { |
| | | |
| | | /** |
| | | * saveScheduleTime |
| | | * |
| | | * @param map |
| | | */ |
| | | void saveScheduleTime(Map map); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeDetailesEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.ScheduleSchemeDetailesVo; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 9:06 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleSchemeDetailesDao extends BaseMapperX<StScheduleSchemeDetailesEntity> { |
| | | /** |
| | | * 查询调度方案详情 |
| | | * |
| | | * @param params |
| | | * @return |
| | | */ |
| | | List<ScheduleSchemeDetailesVo> queryScheduleSchemeDetailes(@Param("params") Map<String, Object> params); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEvalTypeEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 9:10 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleSchemeEvalTypeDao extends BaseMapperX<StScheduleSchemeEvalTypeEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEvalValueEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 9:14 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleSchemeEvalValueDao extends BaseMapperX<StScheduleSchemeEvalValueEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dao; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.mybatis.core.mapper.BaseMapperX; |
| | | import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleUserEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleUserPageReqVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 9:16 |
| | | */ |
| | | @Mapper |
| | | public interface StScheduleUserDao extends BaseMapperX<StScheduleUserEntity> { |
| | | |
| | | default PageResult<StScheduleUserEntity> selectPage(StScheduleUserPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<StScheduleUserEntity>() |
| | | .likeIfPresent(StScheduleUserEntity::getUsername, reqVO.getUsername()) |
| | | .orderByDesc(StScheduleUserEntity::getUsername)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dto; |
| | | |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelUserParamEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamSettingEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月21日 17:44 |
| | | */ |
| | | @Data |
| | | public class StScheduleModelDto implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 模型名称 |
| | | */ |
| | | private String modelname; |
| | | |
| | | |
| | | /** |
| | | * 调度ID |
| | | */ |
| | | private String scheduleid; |
| | | |
| | | /** |
| | | * 对象ID |
| | | */ |
| | | private String objectid; |
| | | |
| | | /** |
| | | * 类名 |
| | | */ |
| | | private String classname; |
| | | |
| | | /** |
| | | * 方法名 |
| | | */ |
| | | private String methodname; |
| | | |
| | | /** |
| | | * 模型路径 |
| | | */ |
| | | private String modelpath; |
| | | |
| | | /** |
| | | * 端口长度 |
| | | */ |
| | | private Integer portlength; |
| | | |
| | | /** |
| | | * 模型状态 |
| | | */ |
| | | private Integer modelstatus; |
| | | |
| | | /** |
| | | * stScheduleParamSettingList |
| | | */ |
| | | private List<StScheduleParamSettingEntity> stScheduleParamSettingList; |
| | | |
| | | /** |
| | | * stScheduleParamList |
| | | */ |
| | | private List<StScheduleParamEntity> stScheduleParamList; |
| | | |
| | | /** |
| | | * stScheduleModelUserParamList |
| | | */ |
| | | private List<StScheduleModelUserParamEntity> stScheduleModelUserParamList; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年11月02日 15:55 |
| | | */ |
| | | @Data |
| | | public class StSchedulePredictItemDto implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 标题 |
| | | */ |
| | | private String title; |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String predictitemid; |
| | | |
| | | /** |
| | | * 预测项Name |
| | | */ |
| | | private String itemname; |
| | | |
| | | /** |
| | | * 调度模型ID |
| | | */ |
| | | private String schedulemodelid; |
| | | |
| | | /** |
| | | * 调度模型Name |
| | | */ |
| | | private String modelname; |
| | | |
| | | /** |
| | | * 最大值 |
| | | */ |
| | | private String maxvaluekey; |
| | | |
| | | /** |
| | | * 最大值 |
| | | */ |
| | | private String maxValue; |
| | | |
| | | /** |
| | | * 最小值 |
| | | */ |
| | | private String minvaluekey; |
| | | |
| | | /** |
| | | * 最大值 |
| | | */ |
| | | private String minValue; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 14:55 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_ENERGY_TYPE") |
| | | public class StScheduleEnergyTypeEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 类型名称 |
| | | */ |
| | | @NotBlank(message="类型名称不能为空") |
| | | private String energytypename; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 14:30 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE") |
| | | public class StScheduleEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @NotBlank(message="名称不能为空") |
| | | private String name; |
| | | |
| | | /** |
| | | * 调度时间 |
| | | */ |
| | | private Date scheduletime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 15:03 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_MODEL") |
| | | public class StScheduleModelEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 模型名称 |
| | | */ |
| | | @NotBlank(message="模型名称不能为空") |
| | | private String modelname; |
| | | |
| | | |
| | | /** |
| | | * 调度ID |
| | | */ |
| | | private String scheduleid; |
| | | |
| | | /** |
| | | * 对象ID |
| | | */ |
| | | private String objectid; |
| | | |
| | | /** |
| | | * 类名 |
| | | */ |
| | | private String classname; |
| | | |
| | | /** |
| | | * 方法名 |
| | | */ |
| | | private String methodname; |
| | | |
| | | /** |
| | | * 模型路径 |
| | | */ |
| | | private String modelpath; |
| | | |
| | | /** |
| | | * 端口长度 |
| | | */ |
| | | private Integer portlength; |
| | | |
| | | /** |
| | | * 模型状态 |
| | | */ |
| | | private Integer modelstatus; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 15:35 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_MODEL_USER_PARAM") |
| | | public class StScheduleModelUserParamEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 模型ID |
| | | */ |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | private String userid; |
| | | |
| | | /** |
| | | * 能源类型ID |
| | | */ |
| | | private String energytypeid; |
| | | |
| | | /** |
| | | * 参数ID |
| | | */ |
| | | private String paramid; |
| | | |
| | | /** |
| | | * 模型状态 |
| | | */ |
| | | private String modelsatus; |
| | | |
| | | /** |
| | | * 用户排序 |
| | | */ |
| | | private Integer userorder; |
| | | |
| | | /** |
| | | * 能源排序 |
| | | */ |
| | | private Integer energyorder; |
| | | |
| | | /** |
| | | * 是否调整 |
| | | */ |
| | | private Integer isadjust; |
| | | |
| | | /** |
| | | * 调整上限 |
| | | */ |
| | | private BigDecimal upadjlimit; |
| | | |
| | | /** |
| | | * 调整下限 |
| | | */ |
| | | private BigDecimal downadjlimit; |
| | | |
| | | /** |
| | | * 调整排序 |
| | | */ |
| | | private Integer adjorder; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 16:10 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_OBJECT") |
| | | public class StScheduleObjectEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @NotBlank(message="名称不能为空") |
| | | private String name; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private Integer order; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 16:17 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_PARAM") |
| | | public class StScheduleParamEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 模型ID |
| | | */ |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 模型参数名称 |
| | | */ |
| | | private String modelparamname; |
| | | |
| | | /** |
| | | * 模型参数ID |
| | | */ |
| | | private String modelparamid; |
| | | |
| | | /** |
| | | * 模型参数排序 |
| | | */ |
| | | private Integer modelparamorder; |
| | | |
| | | /** |
| | | * 模型参数端口排序 |
| | | */ |
| | | private Integer modelparamportorder; |
| | | |
| | | /** |
| | | * 数据长度 |
| | | */ |
| | | private Integer datalength; |
| | | |
| | | /** |
| | | * 数据类型 |
| | | */ |
| | | private String modelparamtype; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 16:35 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_PARAM_SETTING") |
| | | public class StScheduleParamSettingEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 模型ID |
| | | */ |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 键 |
| | | */ |
| | | private String key; |
| | | |
| | | /** |
| | | * 值 |
| | | */ |
| | | private String value; |
| | | |
| | | /** |
| | | * 值类型 |
| | | */ |
| | | private String valuetype; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年11月02日 15:18 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_PREDICT_ITEM") |
| | | public class StSchedulePredictItemEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String predictitemid; |
| | | |
| | | /** |
| | | * 调度模型ID |
| | | */ |
| | | private String schedulemodelid; |
| | | |
| | | /** |
| | | * 最大值 |
| | | */ |
| | | private String maxvaluekey; |
| | | |
| | | /** |
| | | * 最小值 |
| | | */ |
| | | private String minvaluekey; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private Date updateTime; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:14 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_SCHEME_DETAILES") |
| | | public class StScheduleSchemeDetailesEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 调整用户ID |
| | | */ |
| | | private String adjustuserid; |
| | | |
| | | /** |
| | | * 方案ID |
| | | */ |
| | | private String schemid; |
| | | |
| | | /** |
| | | * 值 |
| | | */ |
| | | private BigDecimal value; |
| | | |
| | | /** |
| | | * 是否调整 |
| | | */ |
| | | private BigDecimal isadjust; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.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 |
| | | * @date 2021年07月19日 16:43 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_SCHEME") |
| | | public class StScheduleSchemeEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 模型ID |
| | | */ |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 开始时间 |
| | | */ |
| | | private Date starttime; |
| | | |
| | | /** |
| | | * 结束时间 |
| | | */ |
| | | private Date endtime; |
| | | |
| | | /** |
| | | * 调度时间 |
| | | */ |
| | | private Date scheduletime; |
| | | |
| | | /** |
| | | * 对象值 |
| | | */ |
| | | private BigDecimal objectvalue; |
| | | |
| | | /** |
| | | * 方案排序 |
| | | */ |
| | | private Integer schemeorder; |
| | | |
| | | /** |
| | | * 是否调整 |
| | | */ |
| | | private Integer isadjust; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:24 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_SCHEME_EVAL_TYPE") |
| | | public class StScheduleSchemeEvalTypeEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String evalname; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:33 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_SCHEME_EVAL_VALUE") |
| | | public class StScheduleSchemeEvalValueEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 方案ID |
| | | */ |
| | | private String schemid; |
| | | |
| | | /** |
| | | * evalid |
| | | */ |
| | | private String evalid; |
| | | |
| | | /** |
| | | * schprevalue |
| | | */ |
| | | private BigDecimal schprevalue; |
| | | |
| | | /** |
| | | * schedvalue |
| | | */ |
| | | private BigDecimal schedvalue; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.entity; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:42 |
| | | */ |
| | | |
| | | 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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月19日 17:33 |
| | | */ |
| | | @Data |
| | | @TableName("T_ST_SCHEDULE_USER") |
| | | public class StScheduleUserEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(value = "id",type = IdType.INPUT) |
| | | private String id; |
| | | |
| | | /** |
| | | * 用户名称 |
| | | */ |
| | | private String username; |
| | | |
| | | /** |
| | | * 调整状态 |
| | | */ |
| | | private String adjuststatus; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleEnergyTypeEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleEnergyTypePageReqVO; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 11:45 |
| | | */ |
| | | public interface StScheduleEnergyTypeService extends BaseService<StScheduleEnergyTypeEntity> { |
| | | |
| | | void saveScheduleEnergyType(StScheduleEnergyTypeEntity scheduleEnergyType); |
| | | |
| | | void update(StScheduleEnergyTypeEntity scheduleEnergyType); |
| | | |
| | | void deleteBatch(String[] scheduleEnergyTypeIds); |
| | | |
| | | int check(StScheduleEnergyTypeEntity scheduleEnergyType); |
| | | |
| | | PageResult<StScheduleEnergyTypeEntity> page(StScheduleEnergyTypePageReqVO reqVO); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.dto.StScheduleModelDto; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleModelRespVO; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 14:13 |
| | | */ |
| | | public interface StScheduleModelService extends BaseService<StScheduleModelEntity> { |
| | | |
| | | void saveStScheduleModel(StScheduleModelDto stScheduleModel); |
| | | |
| | | StScheduleModelDto getDetailById(String id); |
| | | |
| | | void update(StScheduleModelDto stScheduleModel); |
| | | |
| | | void deleteBatch(String[] stScheduleModelIds); |
| | | |
| | | int check(StScheduleModelEntity stScheduleModel); |
| | | |
| | | PageResult<StScheduleModelRespVO> getPageList(Map<String, Object> params); |
| | | |
| | | Long count(); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelUserParamEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.ScheduleModelUserParamVo; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月22日 10:37 |
| | | */ |
| | | public interface StScheduleModelUserParamService extends BaseService<StScheduleModelUserParamEntity> { |
| | | |
| | | List<StScheduleModelUserParamEntity> getByModelid(String modelid); |
| | | |
| | | PageData<ScheduleModelUserParamVo> page(Map<String, Object> params); |
| | | } |
| | | |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleObjectEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleObjectPageReqVO; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 17:49 |
| | | */ |
| | | public interface StScheduleObjectService extends BaseService<StScheduleObjectEntity> { |
| | | |
| | | void saveStScheduleObject(StScheduleObjectEntity scheduleObject); |
| | | |
| | | void update(StScheduleObjectEntity scheduleObject); |
| | | |
| | | void deleteBatch(String[] scheduleObjectIds); |
| | | |
| | | int check(StScheduleObjectEntity scheduleObject); |
| | | |
| | | PageResult<StScheduleObjectEntity> page(StScheduleObjectPageReqVO reqVO); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamEntity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月22日 10:03 |
| | | */ |
| | | public interface StScheduleParamService extends BaseService<StScheduleParamEntity> { |
| | | |
| | | List<StScheduleParamEntity> getByModelid(String modelid); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamSettingEntity; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月22日 9:05 |
| | | */ |
| | | public interface StScheduleParamSettingService extends BaseService<StScheduleParamSettingEntity> { |
| | | |
| | | List<StScheduleParamSettingEntity> getByModelid(String modelid); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeDetailesEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.ScheduleSchemeDetailesVo; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月26日 16:49 |
| | | */ |
| | | public interface StScheduleSchemeDetailesService extends BaseService<StScheduleSchemeDetailesEntity> { |
| | | |
| | | List<ScheduleSchemeDetailesVo> queryScheduleSchemeDetailes(Map<String, Object> params); |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年08月11日 12:06 |
| | | */ |
| | | public interface StScheduleSchemeService extends BaseService<StScheduleSchemeEntity> { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StSchedulePageReqVO; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 11:36 |
| | | */ |
| | | public interface StScheduleService extends BaseService<StScheduleEntity> { |
| | | |
| | | void saveSchedule(StScheduleEntity stSchedule); |
| | | |
| | | void update(StScheduleEntity stSchedule); |
| | | |
| | | void deleteBatch(String[] stScheduleIds); |
| | | |
| | | int check(StScheduleEntity stSchedule); |
| | | |
| | | PageResult<StScheduleEntity> page(StSchedulePageReqVO reqVO); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service; |
| | | |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.BaseService; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleUserEntity; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleUserPageReqVO; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 15:09 |
| | | */ |
| | | public interface StScheduleUserService extends BaseService<StScheduleUserEntity> { |
| | | |
| | | void saveScheduleUser(StScheduleUserEntity scheduleUser); |
| | | |
| | | void update(StScheduleUserEntity scheduleUser); |
| | | |
| | | void deleteBatch(String[] scheduleUserIds); |
| | | |
| | | int check(StScheduleUserEntity scheduleUser); |
| | | |
| | | PageResult<StScheduleUserEntity> page(StScheduleUserPageReqVO reqVO); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleEnergyTypeDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleEnergyTypeEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleEnergyTypeService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleEnergyTypePageReqVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 11:47 |
| | | */ |
| | | @Service("stScheduleEnergyTypeService") |
| | | public class StScheduleEnergyTypeServiceImpl extends BaseServiceImpl<StScheduleEnergyTypeDao, StScheduleEnergyTypeEntity> implements StScheduleEnergyTypeService { |
| | | @Override |
| | | public PageResult<StScheduleEnergyTypeEntity> page(StScheduleEnergyTypePageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | private QueryWrapper<StScheduleEnergyTypeEntity> getWrapper(Map<String, Object> params) { |
| | | String energytypename = (String) params.get("energytypename"); |
| | | |
| | | QueryWrapper<StScheduleEnergyTypeEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(energytypename), "energytypename", energytypename); |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | public StScheduleEnergyTypeEntity getDetailById(String id) { |
| | | StScheduleEnergyTypeEntity entity = baseDao.selectById(id); |
| | | return entity; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveScheduleEnergyType(StScheduleEnergyTypeEntity scheduleEnergyType) { |
| | | scheduleEnergyType.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(scheduleEnergyType); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(StScheduleEnergyTypeEntity scheduleEnergyType) { |
| | | baseDao.updateById(scheduleEnergyType); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] storeTypeIds) { |
| | | baseDao.deleteBatchIds(Arrays.asList(storeTypeIds)); |
| | | } |
| | | |
| | | @Override |
| | | public int check(StScheduleEnergyTypeEntity scheduleEnergyType) { |
| | | String id = scheduleEnergyType.getId(); |
| | | String energytypename = scheduleEnergyType.getEnergytypename(); |
| | | QueryWrapper<StScheduleEnergyTypeEntity> scheduleEnergyTypeWrapper = new QueryWrapper<>(); |
| | | scheduleEnergyTypeWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | scheduleEnergyTypeWrapper.and(wrapper -> wrapper.eq("energytypename", energytypename)); |
| | | |
| | | List<StScheduleEnergyTypeEntity> list = baseDao.selectList(scheduleEnergyTypeWrapper); |
| | | return list.size(); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleModelDao; |
| | | import com.iailab.module.model.mcs.sche.dto.StScheduleModelDto; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelUserParamEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamSettingEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleModelService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleModelRespVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 14:23 |
| | | */ |
| | | @Service("stScheduleModelService") |
| | | public class StScheduleModelServiceImpl extends BaseServiceImpl<StScheduleModelDao, StScheduleModelEntity> implements StScheduleModelService { |
| | | @Autowired |
| | | private StScheduleParamSettingServiceImpl stScheduleParamSettingServiceImpl; |
| | | |
| | | @Autowired |
| | | private StScheduleParamServiceImpl stScheduleParamServiceImpl; |
| | | |
| | | @Autowired |
| | | private StScheduleModelUserParamServiceImpl stScheduleModelUserParamServiceImpl; |
| | | |
| | | @Override |
| | | public PageResult<StScheduleModelRespVO> getPageList(Map<String, Object> params) { |
| | | PageResult<StScheduleModelRespVO> result = new PageResult(); |
| | | IPage<StScheduleModelRespVO> page = baseDao.getPageList( |
| | | getPage(params, null, false), |
| | | params |
| | | ); |
| | | result.setTotal(page.getTotal()); |
| | | result.setList(page.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | | private QueryWrapper<StScheduleModelEntity> getWrapper(Map<String, Object> params) { |
| | | QueryWrapper<StScheduleModelEntity> wrapper = new QueryWrapper<>(); |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveStScheduleModel(StScheduleModelDto scheduleModel) { |
| | | StScheduleModelEntity stScheduleModelEntity = new StScheduleModelEntity(); |
| | | BeanUtils.copyProperties(scheduleModel, stScheduleModelEntity); |
| | | stScheduleModelEntity.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(stScheduleModelEntity); |
| | | |
| | | scheduleModel.getStScheduleParamSettingList().forEach(item -> { |
| | | item.setModelid(stScheduleModelEntity.getId()); |
| | | }); |
| | | stScheduleParamSettingServiceImpl.saveList(scheduleModel.getStScheduleParamSettingList()); |
| | | |
| | | scheduleModel.getStScheduleParamList().forEach(item -> { |
| | | item.setModelid(stScheduleModelEntity.getId()); |
| | | }); |
| | | stScheduleParamServiceImpl.saveList(scheduleModel.getStScheduleParamList()); |
| | | |
| | | scheduleModel.getStScheduleModelUserParamList().forEach(item -> { |
| | | item.setModelid(stScheduleModelEntity.getId()); |
| | | }); |
| | | stScheduleModelUserParamServiceImpl.saveList(scheduleModel.getStScheduleModelUserParamList()); |
| | | } |
| | | |
| | | @Override |
| | | public StScheduleModelDto getDetailById(String id) { |
| | | StScheduleModelDto scheduleMode = new StScheduleModelDto(); |
| | | StScheduleModelEntity stScheduleModelEntity = baseDao.selectById(id); |
| | | BeanUtils.copyProperties(stScheduleModelEntity, scheduleMode); |
| | | List<StScheduleParamSettingEntity> stScheduleParamSettingList = stScheduleParamSettingServiceImpl.getByModelid(stScheduleModelEntity.getId()); |
| | | scheduleMode.setStScheduleParamSettingList(stScheduleParamSettingList); |
| | | List<StScheduleParamEntity> stScheduleParamList = stScheduleParamServiceImpl.getByModelid(stScheduleModelEntity.getId()); |
| | | scheduleMode.setStScheduleParamList(stScheduleParamList); |
| | | List<StScheduleModelUserParamEntity> stScheduleModelUserParamList = stScheduleModelUserParamServiceImpl.getByModelid(stScheduleModelEntity.getId()); |
| | | scheduleMode.setStScheduleModelUserParamList(stScheduleModelUserParamList); |
| | | return scheduleMode; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(StScheduleModelDto scheduleModel) { |
| | | StScheduleModelEntity stScheduleModelEntity = new StScheduleModelEntity(); |
| | | BeanUtils.copyProperties(scheduleModel, stScheduleModelEntity); |
| | | baseDao.updateById(stScheduleModelEntity); |
| | | |
| | | scheduleModel.getStScheduleParamSettingList().forEach(item -> { |
| | | item.setModelid(stScheduleModelEntity.getId()); |
| | | }); |
| | | stScheduleParamSettingServiceImpl.saveList(scheduleModel.getStScheduleParamSettingList()); |
| | | |
| | | scheduleModel.getStScheduleParamList().forEach(item -> { |
| | | item.setModelid(stScheduleModelEntity.getId()); |
| | | }); |
| | | stScheduleParamServiceImpl.saveList(scheduleModel.getStScheduleParamList()); |
| | | |
| | | scheduleModel.getStScheduleModelUserParamList().forEach(item -> { |
| | | item.setModelid(stScheduleModelEntity.getId()); |
| | | }); |
| | | stScheduleModelUserParamServiceImpl.saveList(scheduleModel.getStScheduleModelUserParamList()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] scheduleModelIds) { |
| | | baseDao.deleteBatchIds(Arrays.asList(scheduleModelIds)); |
| | | stScheduleParamSettingServiceImpl.deleteBatch(scheduleModelIds); |
| | | stScheduleParamServiceImpl.deleteBatch(scheduleModelIds); |
| | | stScheduleModelUserParamServiceImpl.deleteBatch(scheduleModelIds); |
| | | } |
| | | |
| | | @Override |
| | | public int check(StScheduleModelEntity scheduleModel) { |
| | | String id = scheduleModel.getId(); |
| | | String modelname = scheduleModel.getModelname(); |
| | | QueryWrapper<StScheduleModelEntity> scheduleModelWrapper = new QueryWrapper<>(); |
| | | scheduleModelWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | scheduleModelWrapper.and(wrapper -> wrapper.eq("modelname", modelname)); |
| | | |
| | | List<StScheduleModelEntity> list = baseDao.selectList(scheduleModelWrapper); |
| | | return list.size(); |
| | | } |
| | | |
| | | @Override |
| | | public Long count() { |
| | | QueryWrapper<StScheduleModelEntity> wrapper = new QueryWrapper<>(); |
| | | return baseDao.selectCount(wrapper); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleModelUserParamDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleModelUserParamEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleModelUserParamService; |
| | | import com.iailab.module.model.mcs.sche.vo.ScheduleModelUserParamVo; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月22日 10:40 |
| | | */ |
| | | @Service("stScheduleModelUserParamService") |
| | | public class StScheduleModelUserParamServiceImpl extends BaseServiceImpl<StScheduleModelUserParamDao, StScheduleModelUserParamEntity> implements StScheduleModelUserParamService { |
| | | @Override |
| | | public PageData<ScheduleModelUserParamVo> page(Map<String, Object> params) { |
| | | IPage<StScheduleModelUserParamEntity> page = baseDao.selectPage( |
| | | getPage(params, null, false), |
| | | getWrapper(params) |
| | | ); |
| | | return getPageData(page, ScheduleModelUserParamVo.class); |
| | | } |
| | | |
| | | private QueryWrapper<StScheduleModelUserParamEntity> getWrapper(Map<String, Object> params) { |
| | | QueryWrapper<StScheduleModelUserParamEntity> wrapper = new QueryWrapper<>(); |
| | | return wrapper; |
| | | } |
| | | |
| | | @Override |
| | | public List<StScheduleModelUserParamEntity> getByModelid(String modelid) { |
| | | QueryWrapper<StScheduleModelUserParamEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", modelid); |
| | | queryWrapper.orderByAsc("USERID"); |
| | | queryWrapper.orderByAsc("ENERGYTYPEID"); |
| | | List<StScheduleModelUserParamEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public void saveList(List<StScheduleModelUserParamEntity> list) { |
| | | QueryWrapper<StScheduleModelUserParamEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", list.get(0).getModelid()); |
| | | baseDao.delete(queryWrapper); |
| | | list.forEach(item -> { |
| | | item.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(item); |
| | | }); |
| | | } |
| | | |
| | | public void deleteBatch(String[] modelIds) { |
| | | QueryWrapper queryWrapper = new QueryWrapper<StScheduleModelUserParamEntity>(); |
| | | queryWrapper.in("modelid", modelIds); |
| | | baseDao.delete(queryWrapper); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleObjectDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleObjectEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleObjectService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleObjectPageReqVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 17:53 |
| | | */ |
| | | @Service("stScheduleObjectService") |
| | | public class StScheduleObjectServiceImpl extends BaseServiceImpl<StScheduleObjectDao, StScheduleObjectEntity> implements StScheduleObjectService { |
| | | |
| | | @Override |
| | | public PageResult<StScheduleObjectEntity> page(StScheduleObjectPageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | private QueryWrapper<StScheduleObjectEntity> getWrapper(Map<String, Object> params) { |
| | | String name = (String)params.get("name"); |
| | | |
| | | QueryWrapper<StScheduleObjectEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(name),"name", name); |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | public StScheduleObjectEntity getDetailById(String id) { |
| | | return baseDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveStScheduleObject(StScheduleObjectEntity scheduleObject) { |
| | | scheduleObject.setId(UUID.randomUUID().toString()); |
| | | insert(scheduleObject); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(StScheduleObjectEntity scheduleObject) { |
| | | this.updateById(scheduleObject); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] scheduleObjectIds) { |
| | | deleteBatchIds(Arrays.asList(scheduleObjectIds)); |
| | | } |
| | | |
| | | @Override |
| | | public int check(StScheduleObjectEntity scheduleObject) { |
| | | String id = scheduleObject.getId(); |
| | | String name = scheduleObject.getName(); |
| | | QueryWrapper<StScheduleObjectEntity> scheduleObjectWrapper = new QueryWrapper<>(); |
| | | scheduleObjectWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | scheduleObjectWrapper.and(wrapper -> wrapper.eq("name", name)); |
| | | |
| | | List<StScheduleObjectEntity> list = baseDao.selectList(scheduleObjectWrapper); |
| | | return list.size(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleParamDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleParamService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月22日 10:05 |
| | | */ |
| | | @Service("stScheduleParamService") |
| | | public class StScheduleParamServiceImpl extends BaseServiceImpl<StScheduleParamDao, StScheduleParamEntity> implements StScheduleParamService { |
| | | |
| | | @Override |
| | | public List<StScheduleParamEntity> getByModelid(String modelid) { |
| | | QueryWrapper<StScheduleParamEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", modelid); |
| | | queryWrapper.orderByAsc("MODELPARAMPORTORDER"); |
| | | queryWrapper.orderByAsc("MODELPARAMORDER"); |
| | | List<StScheduleParamEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public void saveList(List<StScheduleParamEntity> list) { |
| | | QueryWrapper<StScheduleParamEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", list.get(0).getModelid()); |
| | | baseDao.delete(queryWrapper); |
| | | //scheduleModelEntityFactory.removeModelInputParam(list.get(0).getModelid()); |
| | | list.forEach(item -> { |
| | | item.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(item); |
| | | }); |
| | | } |
| | | |
| | | public void deleteBatch(String[] modelIds) { |
| | | QueryWrapper queryWrapper = new QueryWrapper<StScheduleParamEntity>(); |
| | | queryWrapper.in("modelid", modelIds); |
| | | baseDao.delete(queryWrapper); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleParamSettingDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleParamSettingEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleParamSettingService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月22日 9:07 |
| | | */ |
| | | @Service("stScheduleParamSettingService") |
| | | public class StScheduleParamSettingServiceImpl extends BaseServiceImpl<StScheduleParamSettingDao, StScheduleParamSettingEntity> implements StScheduleParamSettingService { |
| | | |
| | | @Override |
| | | public List<StScheduleParamSettingEntity> getByModelid(String modelid) { |
| | | QueryWrapper<StScheduleParamSettingEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", modelid); |
| | | queryWrapper.orderByAsc("key"); |
| | | List<StScheduleParamSettingEntity> list = baseDao.selectList(queryWrapper); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public void saveList(List<StScheduleParamSettingEntity> list) { |
| | | QueryWrapper<StScheduleParamSettingEntity> queryWrapper = new QueryWrapper(); |
| | | queryWrapper.eq("modelid", list.get(0).getModelid()); |
| | | baseDao.delete(queryWrapper); |
| | | list.forEach(item -> { |
| | | item.setId(UUID.randomUUID().toString()); |
| | | baseDao.insert(item); |
| | | }); |
| | | } |
| | | |
| | | public void deleteBatch(String[] modelIds) { |
| | | QueryWrapper queryWrapper = new QueryWrapper<StScheduleParamSettingEntity>(); |
| | | queryWrapper.in("modelid", modelIds); |
| | | baseDao.delete(queryWrapper); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleSchemeDetailesDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeDetailesEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleSchemeDetailesService; |
| | | import com.iailab.module.model.mcs.sche.vo.ScheduleSchemeDetailesVo; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月26日 16:50 |
| | | */ |
| | | @Service("stScheduleSchemeDetailesService") |
| | | public class StScheduleSchemeDetailesServiceImpl extends BaseServiceImpl<StScheduleSchemeDetailesDao, StScheduleSchemeDetailesEntity> |
| | | implements StScheduleSchemeDetailesService { |
| | | |
| | | private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | @Override |
| | | public List<ScheduleSchemeDetailesVo> queryScheduleSchemeDetailes(Map<String, Object> params) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.add(Calendar.HOUR_OF_DAY, -1); |
| | | if (StringUtils.isBlank((String)params.get("startTime"))) { |
| | | params.put("startTime", calendar.getTime()); |
| | | } |
| | | return baseDao.queryScheduleSchemeDetailes(params); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleSchemeDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSchemeEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleSchemeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年08月11日 12:06 |
| | | */ |
| | | @Service("stScheduleSchemeService") |
| | | public class StScheduleSchemeServiceImpl extends BaseServiceImpl<StScheduleSchemeDao, StScheduleSchemeEntity> |
| | | implements StScheduleSchemeService { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleService; |
| | | import com.iailab.module.model.mcs.sche.vo.StSchedulePageReqVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 11:37 |
| | | */ |
| | | @Service("stScheduleService") |
| | | public class StScheduleServiceImpl extends BaseServiceImpl<StScheduleDao, StScheduleEntity> implements StScheduleService { |
| | | |
| | | @Override |
| | | public PageResult<StScheduleEntity> page(StSchedulePageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | private QueryWrapper<StScheduleEntity> getWrapper(Map<String, Object> params) { |
| | | String name = (String) params.get("name"); |
| | | |
| | | QueryWrapper<StScheduleEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(name), "name", name); |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | public StScheduleEntity getDetailById(String id) { |
| | | return baseDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveSchedule(StScheduleEntity schedule) { |
| | | schedule.setId(UUID.randomUUID().toString()); |
| | | schedule.setScheduletime(new Date()); |
| | | baseDao.insert(schedule); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(StScheduleEntity schedule) { |
| | | baseDao.updateById(schedule); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] storeTypeIds) { |
| | | baseDao.deleteBatchIds(Arrays.asList(storeTypeIds)); |
| | | } |
| | | |
| | | @Override |
| | | public int check(StScheduleEntity schedule) { |
| | | String id = schedule.getId(); |
| | | String name = schedule.getName(); |
| | | QueryWrapper<StScheduleEntity> scheduleWrapper = new QueryWrapper<>(); |
| | | scheduleWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | scheduleWrapper.and(wrapper -> wrapper.eq("name", name)); |
| | | |
| | | List<StScheduleEntity> list = baseDao.selectList(scheduleWrapper); |
| | | return list.size(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.module.model.mcs.sche.dao.StScheduleUserDao; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleUserEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleUserService; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleUserPageReqVO; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月20日 15:15 |
| | | */ |
| | | @Service("stScheduleUserService") |
| | | public class StScheduleUserServiceImpl extends BaseServiceImpl<StScheduleUserDao, StScheduleUserEntity> implements StScheduleUserService { |
| | | |
| | | @Override |
| | | public PageResult<StScheduleUserEntity> page(StScheduleUserPageReqVO reqVO) { |
| | | return baseDao.selectPage(reqVO); |
| | | } |
| | | |
| | | private QueryWrapper<StScheduleUserEntity> getWrapper(Map<String, Object> params) { |
| | | String username = (String)params.get("username"); |
| | | |
| | | QueryWrapper<StScheduleUserEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.like(StringUtils.isNotBlank(username),"username", username); |
| | | |
| | | return wrapper; |
| | | } |
| | | |
| | | public StScheduleUserEntity getDetailById(String id) { |
| | | return baseDao.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveScheduleUser(StScheduleUserEntity scheduleUser) { |
| | | scheduleUser.setId(UUID.randomUUID().toString()); |
| | | insert(scheduleUser); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(StScheduleUserEntity scheduleUser) { |
| | | this.updateById(scheduleUser); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] storeTypeIds) { |
| | | deleteBatchIds(Arrays.asList(storeTypeIds)); |
| | | } |
| | | |
| | | @Override |
| | | public int check(StScheduleUserEntity scheduleUser) { |
| | | String id = scheduleUser.getId(); |
| | | String username = scheduleUser.getUsername(); |
| | | QueryWrapper<StScheduleUserEntity> scheduleUserWrapper = new QueryWrapper<>(); |
| | | scheduleUserWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | scheduleUserWrapper.and(wrapper -> wrapper.eq("username", username)); |
| | | |
| | | List<StScheduleUserEntity> list = baseDao.selectList(scheduleUserWrapper); |
| | | return list.size(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月26日 13:11 |
| | | */ |
| | | @Data |
| | | public class ScheduleModelUserParamVo implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * 模型ID |
| | | */ |
| | | private String modelid; |
| | | |
| | | /** |
| | | * 模型名称 |
| | | */ |
| | | private String modelname; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | private String userid; |
| | | |
| | | /** |
| | | * 用户名称 |
| | | */ |
| | | private String username; |
| | | |
| | | /** |
| | | * 能源类型ID |
| | | */ |
| | | private String energytypeid; |
| | | |
| | | /** |
| | | * 能源类型名称 |
| | | */ |
| | | private String energytypename; |
| | | |
| | | /** |
| | | * 参数ID |
| | | */ |
| | | private String paramid; |
| | | |
| | | /** |
| | | * 模型状态 |
| | | */ |
| | | private String modelsatus; |
| | | |
| | | /** |
| | | * 用户排序 |
| | | */ |
| | | private Integer userorder; |
| | | |
| | | /** |
| | | * 能源排序 |
| | | */ |
| | | private Integer energyorder; |
| | | |
| | | /** |
| | | * 是否调整 |
| | | */ |
| | | private Integer isadjust; |
| | | |
| | | /** |
| | | * 调整上限 |
| | | */ |
| | | private BigDecimal upadjlimit; |
| | | |
| | | /** |
| | | * 调整下限 |
| | | */ |
| | | private BigDecimal downadjlimit; |
| | | |
| | | /** |
| | | * 调整排序 |
| | | */ |
| | | private Integer adjorder; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月26日 11:05 |
| | | */ |
| | | @Data |
| | | public class ScheduleSchemeDetailesVo implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * 调度时间 |
| | | */ |
| | | private Date scheduletime; |
| | | |
| | | /** |
| | | * schemeorder |
| | | */ |
| | | private Integer schemeorder; |
| | | |
| | | /** |
| | | * value |
| | | */ |
| | | private BigDecimal value; |
| | | |
| | | /** |
| | | * modelname |
| | | */ |
| | | private String modelname; |
| | | |
| | | /** |
| | | * userid |
| | | */ |
| | | private String userid; |
| | | |
| | | /** |
| | | * username |
| | | */ |
| | | private String username; |
| | | |
| | | /** |
| | | * energytypeid |
| | | */ |
| | | private String energytypeid; |
| | | |
| | | /** |
| | | * energytypename |
| | | */ |
| | | private String energytypename; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - 管网分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class StScheduleEnergyTypePageReqVO extends PageParam { |
| | | |
| | | private String energytypename; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class StScheduleEnergyTypeRespVO { |
| | | |
| | | private String id; |
| | | |
| | | private String energytypename; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - 管网分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class StScheduleModelPageReqVO extends PageParam { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月21日 14:08 |
| | | */ |
| | | @Schema(description = "模型平台 - Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class StScheduleModelRespVO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 模型名称 |
| | | */ |
| | | private String modelname; |
| | | |
| | | |
| | | /** |
| | | * 调度ID |
| | | */ |
| | | private String scheduleid; |
| | | |
| | | /** |
| | | * 调度名称 |
| | | */ |
| | | private String schedulename; |
| | | |
| | | /** |
| | | * 对象ID |
| | | */ |
| | | private String objectid; |
| | | |
| | | /** |
| | | * 对象名称 |
| | | */ |
| | | private String objectname; |
| | | |
| | | /** |
| | | * 类名 |
| | | */ |
| | | private String classname; |
| | | |
| | | /** |
| | | * 方法名 |
| | | */ |
| | | private String methodname; |
| | | |
| | | /** |
| | | * 模型路径 |
| | | */ |
| | | private String modelpath; |
| | | |
| | | /** |
| | | * 端口长度 |
| | | */ |
| | | private Integer portlength; |
| | | |
| | | /** |
| | | * 模型状态 |
| | | */ |
| | | private Integer modelstatus; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - 管网分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class StScheduleObjectPageReqVO extends PageParam { |
| | | |
| | | private String name; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class StScheduleObjectRespVO { |
| | | |
| | | private String id; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 排序 |
| | | */ |
| | | private Integer order; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - 管网分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class StSchedulePageReqVO extends PageParam { |
| | | |
| | | private String name; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class StScheduleRespVO { |
| | | |
| | | private String id; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 调度时间 |
| | | */ |
| | | private Date scheduletime; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.iailab.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - 管网分页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class StScheduleUserPageReqVO extends PageParam { |
| | | |
| | | private String username; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mcs.sche.vo; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月04日 |
| | | */ |
| | | @Schema(description = "模型平台 - Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class StScheduleUserRespVO { |
| | | |
| | | private String id; |
| | | |
| | | /** |
| | | * 用户名称 |
| | | */ |
| | | private String username; |
| | | |
| | | /** |
| | | * 调整状态 |
| | | */ |
| | | private String adjuststatus; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.dto; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月02日 |
| | | */ |
| | | public class MdkDataDTO { |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.enums; |
| | | |
| | | import org.jetbrains.annotations.Contract; |
| | | |
| | | /** |
| | | * 预测项的预测状态 |
| | | */ |
| | | public enum ItemPredictStatus { |
| | | |
| | | PREDICTING(1), |
| | | |
| | | SUCCESS(2), |
| | | |
| | | FAILED(3); |
| | | |
| | | private Integer value; |
| | | |
| | | @Contract(pure = true) |
| | | ItemPredictStatus(Integer value) { |
| | | this.value = value; |
| | | } |
| | | |
| | | @Contract(pure = true) |
| | | public Integer getValue() { |
| | | return value; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.enums; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年07月29日 11:15 |
| | | */ |
| | | public enum TypeA { |
| | | Predict, Schedule, Train |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.exceptions; |
| | | |
| | | //类 职 责:算法调用异常 |
| | | public class ArithInvokeException extends Exception { |
| | | public final static String errorGetArithEntity = "获取ArithEntity失败"; |
| | | public final static String errorCreateArith = "创建Arith失败"; |
| | | |
| | | private Throwable cause; |
| | | |
| | | public ArithInvokeException() { |
| | | } |
| | | |
| | | public ArithInvokeException(String msg) { |
| | | super(msg); |
| | | } |
| | | |
| | | public ArithInvokeException(String msg, Exception cause) { |
| | | super(msg, cause); |
| | | this.cause = cause; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.exceptions; |
| | | |
| | | public class ArrayLengthMisMatchException extends Exception { |
| | | public final String arrayLengthMisMatch = "数组维数不匹配"; |
| | | |
| | | private Throwable cause; |
| | | |
| | | public ArrayLengthMisMatchException() { |
| | | } |
| | | |
| | | public ArrayLengthMisMatchException(String msg) { |
| | | super(msg); |
| | | } |
| | | |
| | | public ArrayLengthMisMatchException(String msg, Exception cause) { |
| | | super(msg); |
| | | this.cause = cause; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.exceptions; |
| | | |
| | | public class DataAccessException extends Exception { |
| | | public final static String errorDataAccess = "数据库访问失败"; |
| | | private Throwable cause; |
| | | |
| | | public DataAccessException() { |
| | | |
| | | } |
| | | |
| | | public DataAccessException(String msg) { |
| | | super(msg); |
| | | } |
| | | |
| | | public DataAccessException(String msg, Throwable cause) { |
| | | super(msg, cause); |
| | | this.cause = cause; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.exceptions; |
| | | |
| | | public class ErrorCalculateFailedException extends Exception { |
| | | public final String errorrCalculate = "误差计算失败"; |
| | | |
| | | private Throwable cause; |
| | | |
| | | public ErrorCalculateFailedException() { |
| | | } |
| | | |
| | | public ErrorCalculateFailedException(String msg) { |
| | | super(msg); |
| | | } |
| | | |
| | | public ErrorCalculateFailedException(String msg, Exception cause) { |
| | | super(msg, cause); |
| | | this.cause = cause; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.exceptions; |
| | | |
| | | //类 职 责:预测项调用异常 |
| | | public class ItemInvokeException extends Exception { |
| | | public final static String errorGetItemEntity = "获取ItemEntity失败"; |
| | | public final static String errorGetItemOutput = "获取Item输出信息失败"; |
| | | public final static String errorItemFailed = "预测项预测失败"; |
| | | |
| | | private Throwable cause; |
| | | |
| | | public ItemInvokeException() { |
| | | } |
| | | |
| | | public ItemInvokeException(String msg) { |
| | | super(msg); |
| | | } |
| | | |
| | | public ItemInvokeException(String msg, Exception cause) { |
| | | super(msg); |
| | | this.cause = cause; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.exceptions; |
| | | |
| | | //类 职 责:模型调用异常 |
| | | public class ModelInvokeException extends Exception { |
| | | public final static String errorGetModelEntity = "获取modelEntity失败"; |
| | | public final static String errorGetModelInputCount = "获取Model输入信息失败"; |
| | | public final static String errorGetModelOutputCount = "获取Model输出信息失败"; |
| | | public final static String errorGetModelArithParam = "获取模型的算法参数失败"; |
| | | public final static String errorGetModelFile = "获取模型文件失败"; |
| | | |
| | | private Throwable cause; |
| | | |
| | | public ModelInvokeException() { |
| | | |
| | | } |
| | | |
| | | public ModelInvokeException(String msg) { |
| | | super(msg); |
| | | } |
| | | |
| | | public ModelInvokeException(String msg, Throwable cause) { |
| | | super(msg); |
| | | this.cause = cause; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.exceptions; |
| | | |
| | | //类 职 责:数据访问异常 |
| | | public class RealDataLackException extends Exception { |
| | | public final static String errorRealDataLack = "缺少实际值"; |
| | | private Throwable cause; |
| | | |
| | | public RealDataLackException() { |
| | | |
| | | } |
| | | |
| | | public RealDataLackException(String msg) { |
| | | super(msg); |
| | | } |
| | | |
| | | public RealDataLackException(String msg, Exception cause) { |
| | | super(msg, cause); |
| | | this.cause = cause; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.common.exceptions; |
| | | |
| | | //类 职 责:样本准备异常 |
| | | public class SamplePrepareException extends Exception { |
| | | public final String errorGetHistoryData = "获取历史数据失败"; |
| | | private Throwable cause; |
| | | |
| | | public SamplePrepareException() { |
| | | } |
| | | |
| | | public SamplePrepareException(String msg) { |
| | | super(msg); |
| | | } |
| | | |
| | | public SamplePrepareException(String msg, Exception cause) { |
| | | super(msg, cause); |
| | | this.cause = cause; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.factory; |
| | | |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemOutputService; |
| | | import com.iailab.module.model.mcs.pre.service.MmItemTypeService; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.MergeItemVO; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 创建预测项对象的工厂 |
| | | */ |
| | | @Component |
| | | public class ItemEntityFactory { |
| | | private HashMap<String, ItemVO> ItemVOHashMap = new HashMap<>(); |
| | | private Map<String, MmItemTypeEntity> itemTypeMap = new HashMap<>(); |
| | | private Map<String, MergeItemVO> mergeItemMap = new HashMap<>(); |
| | | private Map<String, ItemVO> itemNoEntityMap = new HashMap<>(); |
| | | private Map<String, List<MmItemOutputVO>> itemOutPutItemMap = new HashMap<>(); |
| | | private Map<String, MmItemOutputVO> itemOutputMap = new HashMap<>(); |
| | | |
| | | @Autowired |
| | | private MmPredictItemService mmPredictItemService; |
| | | |
| | | @Autowired |
| | | private MmItemOutputService mmItemOutputService; |
| | | |
| | | @Autowired |
| | | private MmItemTypeService mmItemTypeService; |
| | | |
| | | /** |
| | | * 1.根据ITEMID,获取模型对应的MERGEITEM实体 |
| | | * |
| | | * @param itemId |
| | | * @return |
| | | */ |
| | | public MergeItemVO getMergeItem(String itemId) { |
| | | MergeItemVO mergeItemVO = mmPredictItemService.getMergeItemByItemId(itemId); |
| | | if (!mergeItemMap.containsKey(itemId)) { |
| | | if (mergeItemVO != null) { |
| | | mergeItemMap.put(itemId, mergeItemVO); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return mergeItemVO; |
| | | } |
| | | |
| | | /** |
| | | * 2.根据ITEMNO,获取模型对应的ITEM实体 |
| | | * |
| | | * @param itemNo |
| | | * @return |
| | | */ |
| | | public ItemVO getItemByItemNo(String itemNo) { |
| | | ItemVO ItemVO = mmPredictItemService.getItemByItemNo(itemNo); |
| | | if (!itemNoEntityMap.containsKey(itemNo)) { |
| | | if (ItemVO != null) { |
| | | itemNoEntityMap.put(itemNo, ItemVO); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return ItemVO; |
| | | } |
| | | |
| | | /** |
| | | * 3.根据ITEMID,获取模型对应的ITEM实体 |
| | | * |
| | | * @param itemId |
| | | * @return |
| | | */ |
| | | public ItemVO getItemById(String itemId) { |
| | | ItemVO ItemVO = mmPredictItemService.getItemById(itemId); |
| | | if (!ItemVOHashMap.containsKey(itemId)) { |
| | | if (ItemVO != null) { |
| | | ItemVOHashMap.put(itemId, ItemVO); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return ItemVO; |
| | | } |
| | | |
| | | /** |
| | | * 4. 根据ITEMID,获取模型对应的ITEMOUTPUT实体 |
| | | * |
| | | * @param itemId |
| | | * @return |
| | | */ |
| | | public List<MmItemOutputVO> getOutPutByItemId(String itemId) { |
| | | List<MmItemOutputVO> list = mmItemOutputService.getOutPutByItemId(itemId); |
| | | if (!itemOutPutItemMap.containsKey(itemId)) { |
| | | if (list != null) { |
| | | itemOutPutItemMap.put(itemId, list); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 5. |
| | | * |
| | | * @param outputId |
| | | * @return |
| | | */ |
| | | public MmItemOutputVO getItemOutPutById(String outputId) { |
| | | if (!itemOutputMap.containsKey(outputId)) { |
| | | MmItemOutputVO itemOutput = mmItemOutputService.getOutPutById(outputId); |
| | | if (itemOutput != null) { |
| | | itemOutputMap.put(outputId, itemOutput); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return itemOutputMap.get(outputId); |
| | | } |
| | | |
| | | /** |
| | | * 6.根据预测项ID,获取预测项对应的输出参数的维数 |
| | | * |
| | | * @param itemId |
| | | * @return |
| | | */ |
| | | public Integer getItemOutputCount(String itemId) { |
| | | if (!itemOutPutItemMap.containsKey(itemId)) { |
| | | List<MmItemOutputVO> list = mmItemOutputService.getOutPutByItemId(itemId); |
| | | if (list != null) { |
| | | itemOutPutItemMap.put(itemId, list); |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | return itemOutPutItemMap.get(itemId).size(); |
| | | } |
| | | |
| | | /** |
| | | * 7.根据预测项ID,获取对应的MmItemTypeEntity实体 |
| | | * |
| | | * @param itemId |
| | | * @return |
| | | */ |
| | | public MmItemTypeEntity getMmItemTypeEntity(String itemId) { |
| | | if (!itemTypeMap.containsKey(itemId)) { |
| | | MmItemTypeEntity MmItemTypeEntity = mmItemTypeService.getItemTypeByItemId(itemId); |
| | | if (MmItemTypeEntity != null) { |
| | | itemTypeMap.put(itemId, MmItemTypeEntity); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return itemTypeMap.get(itemId); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.factory; |
| | | |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelArithSettingsEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelArithSettingsService; |
| | | import com.iailab.module.model.mcs.pre.service.MmModelParamService; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictModelService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 创建和管理模型实体 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class ModelEntityFactory { |
| | | |
| | | private Map<String, Object> modelFileMap = new HashMap<>(); |
| | | private Map<String, MmPredictModelEntity> modelEntityMap = new HashMap<>(); |
| | | private Map<String, List<MmModelParamEntity>> modelInputParamMap = new HashMap<>(); |
| | | private Map<String, List<MmModelArithSettingsEntity>> modelArithParamMap = new HashMap<>(); |
| | | private Map<String, List<MmPredictModelEntity>> modelListMap = new HashMap<>(); |
| | | |
| | | @Autowired |
| | | private MmPredictModelService mmPredictModelService; |
| | | |
| | | @Autowired |
| | | private MmModelParamService mmModelParamService; |
| | | |
| | | @Autowired |
| | | private MmModelArithSettingsService mmModelArithSettingsService; |
| | | |
| | | /** |
| | | * 2.根据模型ID,获取模型实体 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | public MmPredictModelEntity getModelEntity(String modelId) { |
| | | MmPredictModelEntity modelEntity = mmPredictModelService.getInfo(modelId); |
| | | if (!modelEntityMap.containsKey(modelId)) { |
| | | if (modelEntity != null) { |
| | | modelEntityMap.put(modelId, modelEntity); |
| | | } |
| | | } |
| | | return modelEntity; |
| | | } |
| | | |
| | | /** |
| | | * 3.根据模型ID,获取模型对应的输入参数 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | public List<MmModelParamEntity> getModelInputParam(String modelId) { |
| | | if (!modelInputParamMap.containsKey(modelId)) { |
| | | List<MmModelParamEntity> modelInputParamEntities = mmModelParamService.getByModelid(modelId); |
| | | if (modelInputParamEntities != null) { |
| | | modelInputParamMap.put(modelId, modelInputParamEntities); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return mmModelParamService.getByModelid(modelId); |
| | | } |
| | | |
| | | /** |
| | | * 4.根据模型ID,获取模型对应的输入参数的维数 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | public Integer getModelInputCount(String modelId) { |
| | | if (!modelInputParamMap.containsKey(modelId)) { |
| | | List<MmModelParamEntity> modelInputParamEntityList = mmModelParamService.getByModelid(modelId); |
| | | if (modelInputParamEntityList != null) { |
| | | modelInputParamMap.put(modelId, modelInputParamEntityList); |
| | | } else { |
| | | return 0; |
| | | } |
| | | } |
| | | return modelInputParamMap.get(modelId).size(); |
| | | } |
| | | |
| | | /** |
| | | * 5.根据模型ID,获取模型对应的算法参数 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | public List<MmModelArithSettingsEntity> getModelArithParam(String modelId) { |
| | | if (!modelArithParamMap.containsKey(modelId)) { |
| | | List<MmModelArithSettingsEntity> modelArithParamEntityList = mmModelArithSettingsService.getByModelId(modelId); |
| | | if (modelArithParamEntityList != null) { |
| | | modelArithParamMap.put(modelId, modelArithParamEntityList); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return modelArithParamMap.get(modelId); |
| | | } |
| | | |
| | | /** |
| | | * 7.根据预测项itemID,获取status=1的模型列表 |
| | | * |
| | | * @param itemId |
| | | * @return |
| | | */ |
| | | public List<MmPredictModelEntity> getActiveModelByItemId(String itemId) { |
| | | if (!modelListMap.containsKey(itemId)) { |
| | | List<MmPredictModelEntity> modelEntityList = mmPredictModelService.getActiveModelByItemId(itemId); |
| | | if (modelEntityList != null) { |
| | | modelListMap.put(itemId, modelEntityList); |
| | | } else { |
| | | return null; |
| | | } |
| | | } |
| | | return modelListMap.get(itemId); |
| | | } |
| | | |
| | | /** |
| | | * 8.根据模型ID,删除模型对应的输入参数 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | public void removeModelInputParam(String modelId) { |
| | | if (modelInputParamMap.containsKey(modelId)) { |
| | | log.info("removeModelInputParam:modelId=" + modelId); |
| | | modelInputParamMap.remove(modelId); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 清除缓存 |
| | | */ |
| | | public void removeModelEntity() { |
| | | modelFileMap.clear(); |
| | | modelEntityMap.clear(); |
| | | modelInputParamMap.clear(); |
| | | modelArithParamMap.clear(); |
| | | modelListMap.clear(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.factory; |
| | | |
| | | import com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 创建预测项对象的工厂 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class PredictItemFactory { |
| | | |
| | | @Autowired |
| | | private ApplicationContext applicationContext; |
| | | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | /** |
| | | * 根据预测项实体创建对应的预测项对象 |
| | | * |
| | | * @param itemId |
| | | * @return |
| | | */ |
| | | public Object create(String itemId) { |
| | | MmItemTypeEntity itemTypeEntity = itemEntityFactory.getMmItemTypeEntity(itemId); |
| | | //获取预测项的预测程序的类 |
| | | Object itemObject = null; |
| | | try { |
| | | Class clazz = Class.forName(itemTypeEntity.getItemclasstype()); |
| | | itemObject = applicationContext.getBean(clazz); |
| | | } catch (Exception e) { |
| | | log.error("exception message : {}", e.getMessage()); |
| | | } |
| | | return itemObject; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.predict; |
| | | |
| | | import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月01日 |
| | | */ |
| | | public interface PredictItemHandler { |
| | | |
| | | PredictResultVO predict(Date predictTime, ItemVO predictItemDto) throws ItemInvokeException; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.predict; |
| | | |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月01日 |
| | | */ |
| | | public interface PredictModelHandler { |
| | | |
| | | PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel) throws ModelInvokeException; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.predict; |
| | | |
| | | import com.iailab.module.model.mcs.pre.enums.ItemStatus; |
| | | import com.iailab.module.model.mdk.factory.PredictItemFactory; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.time.Duration; |
| | | import java.time.Instant; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年08月30日 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class PredictModuleHandler { |
| | | |
| | | |
| | | @Autowired |
| | | private PredictItemFactory predictItemFactory; |
| | | |
| | | @Autowired |
| | | private PredictResultHandler predictResultHandler; |
| | | |
| | | |
| | | public Map<String, PredictResultVO> predict(List<ItemVO> predictItemList, Date predictTime, int intervalTime) { |
| | | Map<String, PredictResultVO> result = new HashMap<>(); |
| | | |
| | | PredictResultVO predictResult = new PredictResultVO(); |
| | | for (ItemVO predictItem : predictItemList) { |
| | | if (!predictItem.getStatus().equals(ItemStatus.STATUS1)) { |
| | | continue; |
| | | } |
| | | try { |
| | | PredictItemHandler predictItemHandler = (PredictItemHandler)predictItemFactory.create(predictItem.getId()); |
| | | Instant start = Instant.now(); |
| | | try { |
| | | predictResult = predictItemHandler.predict(predictTime, predictItem); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error(String.valueOf(e)); |
| | | } |
| | | Instant end = Instant.now(); |
| | | Long drtPre = Duration.between(start, end).getSeconds(); |
| | | log.info(MessageFormat.format("预测项:{0},预测时间:{1}秒", predictItem.getItemName(), drtPre)); |
| | | |
| | | 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)); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error(MessageFormat.format("预测项编号:{0},预测项名称:{1},预测失败:{2} 预测时刻:{3}", |
| | | predictItem.getId(), predictItem.getItemName(), e.getMessage(), predictTime)); |
| | | } |
| | | } |
| | | 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.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.PredictResultVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class PredictResultHandler { |
| | | @Autowired |
| | | private MmItemResultService mmItemResultService; |
| | | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | /** |
| | | * convertToPredictData |
| | | * |
| | | * @param predictResult |
| | | * @return |
| | | */ |
| | | private Map<String, List<DataValueVO>> convertToPredictData(PredictResultVO predictResult) { |
| | | Map<String, List<DataValueVO>> resultMap = new HashMap<>(); |
| | | List<MmItemOutputVO> itemOutPutList = itemEntityFactory.getOutPutByItemId(predictResult.getPredictId()); |
| | | |
| | | if (!CollectionUtils.isEmpty(predictResult.getPredictList())) { |
| | | resultMap.put(itemOutPutList.get(0).getId(), predictResult.getPredictList()); |
| | | return resultMap; |
| | | } |
| | | ApiPointDTO point = dataPointApi.getPointById(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++) { |
| | | List<DataValueVO> predictDataList = new ArrayList<>(); |
| | | for (Integer j = 0; j < rows; j++) { |
| | | DataValueVO predictData = new DataValueVO(); |
| | | predictData.setDataTime(dateTimeList.get(j)); |
| | | predictData.setDataValue(Double.valueOf(predictResult.getPredictMatrix()[j][i])); |
| | | predictDataList.add(predictData); |
| | | } |
| | | resultMap.put(itemOutPutList.get(i).getId(), predictDataList); |
| | | predictResult.setPredictList(predictDataList); |
| | | } |
| | | return resultMap; |
| | | } |
| | | |
| | | /** |
| | | * savePredictResult |
| | | * |
| | | * @param predictResult |
| | | */ |
| | | @Async |
| | | public void savePredictResult(PredictResultVO predictResult) { |
| | | Map<String, List<DataValueVO>> resultMap = convertToPredictData(predictResult); |
| | | mmItemResultService.savePredictValue(resultMap, predictResult.getLt(), "n", predictResult.getPredictTime()); |
| | | } |
| | | |
| | | public List<DataValueVO> getPredictValueByItemNo(String itemNo, Date start, Date end) { |
| | | String itemId = itemEntityFactory.getItemByItemNo(itemNo).getId(); |
| | | List<MmItemOutputVO> outputList = itemEntityFactory.getOutPutByItemId(itemId); |
| | | return mmItemResultService.getPredictValue(outputList.get(0).getId(), start, end); |
| | | } |
| | | |
| | | public List<DataValueVO> getPredictValueByItemId(String itemId, Date start, Date end) { |
| | | List<MmItemOutputVO> outputList = itemEntityFactory.getOutPutByItemId(itemId); |
| | | return mmItemResultService.getPredictValue(outputList.get(0).getId(), start, end); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.predict.impl; |
| | | |
| | | 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.model.mdk.common.enums.ItemPredictStatus; |
| | | import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException; |
| | | import com.iailab.module.model.mdk.factory.ItemEntityFactory; |
| | | import com.iailab.module.model.mdk.factory.PredictItemFactory; |
| | | import com.iailab.module.model.mdk.predict.PredictItemHandler; |
| | | import com.iailab.module.model.mdk.predict.PredictResultHandler; |
| | | import com.iailab.module.model.mdk.vo.DataValueVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月01日 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class PredictItemMergeHandlerImpl implements PredictItemHandler { |
| | | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | @Autowired |
| | | private PredictItemFactory predictItemFactory; |
| | | |
| | | @Autowired |
| | | private PredictResultHandler predictResultHandler; |
| | | |
| | | @Override |
| | | public PredictResultVO predict(Date predictTime, ItemVO predictItemDto) |
| | | throws ItemInvokeException { |
| | | PredictResultVO predictResult = new PredictResultVO(); |
| | | ItemPredictStatus itemStatus = ItemPredictStatus.PREDICTING; |
| | | String itemId = predictItemDto.getId(); |
| | | try { |
| | | String expression = itemEntityFactory.getMergeItem(itemId).getExpression(); |
| | | int predictLength = itemEntityFactory.getItemById(itemId).getPredictLength(); |
| | | double[][] predictResultMat = new double[predictLength][1]; |
| | | Map<String, List<DataValueVO>> predictValueMap = new HashMap<>(); |
| | | String[] mathItem = expression.split("[\\+ \\-]"); |
| | | ArrayList<Character> operator = new ArrayList<>(); |
| | | for (int i = 0; i < expression.length(); i++) { |
| | | if (expression.charAt(i)=='+' || expression.charAt(i)=='-'){ |
| | | operator.add(expression.charAt(i)); |
| | | } |
| | | } |
| | | String[] compositionItem = expression.split(String.valueOf("&".toCharArray())); |
| | | //是否为计算预测项 |
| | | if (mathItem.length > 1) { |
| | | for (String itemNo : mathItem) { |
| | | if (itemNo.length() > 4) { |
| | | Date endTime = predictTime; |
| | | ItemVO itemEntity = itemEntityFactory.getItemByItemNo(itemNo); |
| | | List<MmItemOutputVO> outPutList = itemEntityFactory.getOutPutByItemId(itemEntity.getId()); |
| | | ApiPointDTO pointEntity = dataPointApi.getPointById(outPutList.get(0).getPointId()); |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(endTime); |
| | | calendar.add(Calendar.SECOND, (predictLength - 1) * DataPointFreq.getEumByCode(pointEntity.getMinfreqid()).getValue()); |
| | | endTime = new Timestamp(calendar.getTime().getTime()); |
| | | List<DataValueVO> predictValueList = predictResultHandler.getPredictValueByItemNo(itemNo, predictTime, endTime); |
| | | if (predictValueList.size() != predictLength) { |
| | | log.debug("merge项融合失败:缺少子项预测数据,对应子项ItemNo=" + itemNo); |
| | | return null; |
| | | } |
| | | predictValueMap.put(itemNo, predictValueList); |
| | | } |
| | | } |
| | | for (Integer i = 0; i < predictLength; i++) { |
| | | double sum =0.0; |
| | | sum = predictValueMap.get(mathItem[0]).get(i).getDataValue(); |
| | | for (int j = 1; j < mathItem.length; j++) { |
| | | if (operator.get(j-1)=='+') |
| | | {sum += predictValueMap.get(mathItem[j]).get(i).getDataValue();} |
| | | if (operator.get(j-1)=='-') |
| | | {sum -= predictValueMap.get(mathItem[j]).get(i).getDataValue();} |
| | | } |
| | | predictResultMat[i][0] = sum; |
| | | } |
| | | } |
| | | //是否为组合预测项 |
| | | if (compositionItem.length > 1) { |
| | | Map<String, PredictResultVO> predictResultMap = new HashMap<>(); |
| | | Integer columnTotalNumber = 0; |
| | | Integer rowNumber = 0; |
| | | for (String itemNo : compositionItem) { |
| | | PredictItemHandler predictItem = (PredictItemHandler) predictItemFactory.create(itemEntityFactory. |
| | | getItemByItemNo(itemNo).getId()); |
| | | predictResult = predictItem.predict(predictTime, predictItemDto); |
| | | columnTotalNumber += Integer.valueOf(predictResult.getPredictMatrix().length); |
| | | predictResultMap.put(itemNo, predictItem.predict(predictTime, predictItemDto)); |
| | | } |
| | | double[][] matrix = new double[columnTotalNumber][1]; |
| | | for (String itemNo : compositionItem) { |
| | | for (Integer i = 0; i < predictResultMap.get(itemNo).getPredictMatrix().length; i++) { |
| | | matrix[rowNumber][0] = predictResultMap.get(itemNo).getPredictMatrix()[i][0]; |
| | | rowNumber++; |
| | | } |
| | | } |
| | | predictResult.setPredictMatrix(matrix); |
| | | } |
| | | predictResult.setPredictId(itemId); |
| | | predictResult.setPredictMatrix(predictResultMat); |
| | | predictResult.setPredictTime(predictTime); |
| | | //预测项预测成功的状态 |
| | | itemStatus = ItemPredictStatus.SUCCESS; |
| | | } catch (Exception e) { |
| | | //预测项预测失败的状态 |
| | | itemStatus = ItemPredictStatus.FAILED; |
| | | log.debug("merge项预测失败,itemId:" + itemId); |
| | | throw e; |
| | | } |
| | | log.debug("预测完成,itemId:" + itemId + ",itemStatus:" + itemStatus.getValue()); |
| | | return predictResult; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.predict.impl; |
| | | |
| | | import com.iailab.framework.common.util.collection.CollectionUtils; |
| | | import com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictModelService; |
| | | import com.iailab.module.model.mdk.common.enums.ItemPredictStatus; |
| | | import com.iailab.module.model.mdk.common.exceptions.ItemInvokeException; |
| | | import com.iailab.module.model.mdk.common.exceptions.ModelInvokeException; |
| | | import com.iailab.module.model.mdk.predict.PredictItemHandler; |
| | | import com.iailab.module.model.mdk.predict.PredictModelHandler; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月01日 |
| | | */ |
| | | @Component |
| | | public class PredictItemNormalHandlerImpl implements PredictItemHandler { |
| | | |
| | | @Autowired |
| | | private MmPredictModelService mmPredictModelService; |
| | | |
| | | @Autowired |
| | | private PredictModelHandler predictModelHandler; |
| | | |
| | | @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<>(); |
| | | try { |
| | | // 获取预测项模型 |
| | | List<MmPredictModelEntity> predictModelList = mmPredictModelService.getActiveModelByItemId(itemId); |
| | | if (CollectionUtils.isAnyEmpty(predictModelList)) { |
| | | 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); |
| | | |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | //预测项预测失败的状态 |
| | | itemStatus = ItemPredictStatus.FAILED; |
| | | throw new ItemInvokeException(MessageFormat.format("{0},itemId={1}", |
| | | ItemInvokeException.errorItemFailed, itemId)); |
| | | } |
| | | |
| | | return finalResult; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.predict.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iail.IAILMDK; |
| | | import com.iail.model.IAILModel; |
| | | 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.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 com.iailab.module.model.mdk.sample.SampleConstructor; |
| | | import com.iailab.module.model.mdk.sample.dto.SampleData; |
| | | import com.iailab.module.model.mdk.vo.PredictResultVO; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | 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; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月01日 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class PredictModelHandlerImpl implements PredictModelHandler { |
| | | |
| | | @Autowired |
| | | private MmModelArithSettingsService mmModelArithSettingsService; |
| | | |
| | | @Autowired |
| | | private MmModelResultstrService mmModelResultstrService; |
| | | |
| | | @Autowired |
| | | private SampleConstructor sampleConstructor; |
| | | |
| | | @Override |
| | | public PredictResultVO predictByModel(Date predictTime, MmPredictModelEntity predictModel) throws ModelInvokeException { |
| | | PredictResultVO result = new PredictResultVO(); |
| | | if (predictModel == null) { |
| | | throw new ModelInvokeException("modelEntity is null"); |
| | | } |
| | | String modelId = predictModel.getId(); |
| | | |
| | | try { |
| | | List<SampleData> sampleDataList = sampleConstructor.constructSample(TypeA.Predict.name(), modelId, predictTime); |
| | | String modelPath = predictModel.getModelpath(); |
| | | if (modelPath == null) { |
| | | System.out.println("模型路径不存在,modelId=" + modelId); |
| | | return null; |
| | | } |
| | | IAILModel newModelBean = composeNewModelBean(predictModel); |
| | | HashMap<String, Object> settings = getPredictSettingsByModelId(modelId); |
| | | if (settings == null) { |
| | | log.error("模型setting不存在,modelId=" + modelId); |
| | | return 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[portLength] = newModelBean.getDataMap().get("models"); |
| | | param2Values[portLength+1] = settings; |
| | | |
| | | log.info("#######################预测模型 " + predictModel.getItemid() + " ##########################"); |
| | | JSONObject jsonObjNewModelBean = new JSONObject(); |
| | | jsonObjNewModelBean.put("newModelBean", newModelBean); |
| | | log.info(String.valueOf(jsonObjNewModelBean)); |
| | | JSONObject jsonObjParam2Values = new JSONObject(); |
| | | jsonObjParam2Values.put("param2Values", param2Values); |
| | | log.info(String.valueOf(jsonObjParam2Values)); |
| | | |
| | | //IAILMDK.run |
| | | HashMap<String, Object> modelResult = IAILMDK.run(newModelBean, param2Values); |
| | | //打印结果 |
| | | JSONObject jsonObjResult = new JSONObject(); |
| | | jsonObjResult.put("result", result); |
| | | log.info(String.valueOf(jsonObjResult)); |
| | | |
| | | MmModelResultstrEntity modelResultstr = mmModelResultstrService.getInfo(predictModel.getResultstrid()); |
| | | log.info("模型计算完成:modelId=" + modelId + result); |
| | | double[][] temp = (double[][]) modelResult.get(modelResultstr.getResultstr()); |
| | | result.setPredictMatrix(temp); |
| | | result.setPredictTime(predictTime); |
| | | } catch (Exception ex) { |
| | | log.error("IAILModel对象构造失败,modelId=" + modelId); |
| | | log.error(ex.getMessage()); |
| | | log.error("调用发生异常,异常信息为:{}" , ex); |
| | | ex.printStackTrace(); |
| | | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 构造IAILMDK.run()方法的newModelBean参数 |
| | | * |
| | | * @param predictModel |
| | | * @return |
| | | */ |
| | | private IAILModel composeNewModelBean(MmPredictModelEntity predictModel) { |
| | | IAILModel newModelBean = new IAILModel(); |
| | | newModelBean.setClassName(predictModel.getClassname().trim()); |
| | | newModelBean.setMethodName(predictModel.getMethodname().trim()); |
| | | //构造参数类型 |
| | | String[] paArStr = predictModel.getModelparamstructure().trim().split(","); |
| | | Class<?>[] paramsArray = new Class[paArStr.length]; |
| | | for (int i = 0; i < paArStr.length; i++) { |
| | | if ("[[D".equals(paArStr[i])) { |
| | | paramsArray[i] = double[][].class; |
| | | } else if ("Map".equals(paArStr[i]) || "java.util.HashMap".equals(paArStr[i])) { |
| | | paramsArray[i] = HashMap.class; |
| | | } |
| | | } |
| | | newModelBean.setParamsArray(paramsArray); |
| | | HashMap<String, Object> dataMap = new HashMap<>(); |
| | | HashMap<String, String> models = new HashMap<>(1); |
| | | models.put("paramFile", predictModel.getModelpath()); |
| | | dataMap.put("models", models); |
| | | newModelBean.setDataMap(dataMap); |
| | | return newModelBean; |
| | | } |
| | | |
| | | /** |
| | | * 根据模型id获取参数map |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | private HashMap<String, Object> getPredictSettingsByModelId(String modelId) { |
| | | List<MmModelArithSettingsEntity> list = mmModelArithSettingsService.getByModelId(modelId); |
| | | HashMap<String, Object> result = new HashMap<>(); |
| | | for (MmModelArithSettingsEntity entry : list) { |
| | | String valueType = entry.getValuetype().trim(); //去除两端空格 |
| | | if ("int".equals(valueType)) { |
| | | int value = Integer.parseInt(entry.getValue()); |
| | | result.put(entry.getKey(), value); |
| | | } else if ("double".equals(valueType)) { |
| | | double value = Double.parseDouble(entry.getValue()); |
| | | result.put(entry.getKey(), value); |
| | | } else if ("string".equals(valueType)) { |
| | | String value = entry.getValue(); |
| | | result.put(entry.getKey(), value); |
| | | } else if ("decimalArray".equals(valueType)) { |
| | | JSONArray valueArray = JSONArray.parseArray(entry.getValue()); |
| | | double[] value = new double[valueArray.size()]; |
| | | for (int i = 0; i < valueArray.size(); i++) { |
| | | value[i] = Double.parseDouble(valueArray.get(i).toString()); |
| | | } |
| | | result.put(entry.getKey(), value); |
| | | } else if ("decimal".equals(valueType)) { |
| | | double value = Double.parseDouble(entry.getValue()); |
| | | result.put(entry.getKey(), value); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample; |
| | | |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | | 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.mcs.pre.service.MmItemResultService; |
| | | 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; |
| | | 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 com.iailab.module.model.mdk.vo.MmItemOutputVO; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 预测样本数据构造 |
| | | */ |
| | | @Component |
| | | public class PredictSampleDataConstructor extends SampleDataConstructor { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | @Autowired |
| | | private MmItemResultService mmItemResultService; |
| | | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | /** |
| | | * alter by zfc 2020.11.24 修改数据样本构造方案:sampleInfo中数据已按爪子进行分类,但爪内数据为无序的, |
| | | * 对爪内数据样本拼接:先基于modelParamOrder对项进行排序(重写comparator匿名函数),再逐项拼接 |
| | | * |
| | | * @param sampleInfo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SampleData> prepareSampleData(SampleInfo sampleInfo) { |
| | | List<SampleData> sampleDataList = new ArrayList<>(); |
| | | //对每个爪分别进行计算 |
| | | int deviationIndex = 0; |
| | | for (ColumnItemPort entry : sampleInfo.getColumnInfo()) { |
| | | //先依据爪内数据项的modelParamOrder进行排序——重写comparator匿名函数 |
| | | Collections.sort(entry.getColumnItemList(), new Comparator<ColumnItem>() { |
| | | @Override |
| | | public int compare(ColumnItem o1, ColumnItem o2) { |
| | | return o1.getModelParamOrder() - o2.getModelParamOrder(); |
| | | } |
| | | }); |
| | | |
| | | //默认都是double类型的数据,且按列向量进行拼接,默认初始值为0.0 |
| | | double[][] matrix = new double[entry.getDataLength()][entry.getColumnItemList().size()]; |
| | | for (int i = 0; i < entry.getColumnItemList().size(); i++) { |
| | | for (int j = 0; j < entry.getDataLength(); j++) { |
| | | matrix[j][i] = -2.0; |
| | | } |
| | | } |
| | | |
| | | //找出对应的调整值 |
| | | BigDecimal[] deviationItem = null; |
| | | if (sampleInfo.getDeviation() != null && sampleInfo.getDeviation().length > 0) { |
| | | deviationItem = sampleInfo.getDeviation()[deviationIndex]; |
| | | } |
| | | deviationIndex++; |
| | | |
| | | //对每一项依次进行数据查询,然后将查询出的值赋给matrix对应的位置 |
| | | for (int i = 0; i < entry.getColumnItemList().size(); i++) { |
| | | try { |
| | | List<DataValueVO> dataEntityList = getData(entry.getColumnItemList().get(i)); |
| | | //设置调整值 |
| | | if (deviationItem != null && deviationItem.length > 0) { |
| | | logger.info("设置调整值, i = " + i); |
| | | if (deviationItem[i] != null && deviationItem[i].compareTo(BigDecimal.ZERO) != 0) { |
| | | for (int dataKey = 1; dataKey < dataEntityList.size(); dataKey++) { |
| | | DataValueVO item = dataEntityList.get(dataKey); |
| | | item.setDataValue(item.getDataValue() + deviationItem[i].doubleValue()); |
| | | } |
| | | } |
| | | } |
| | | //补全数据 |
| | | ColumnItem columnItem = entry.getColumnItemList().get(i); |
| | | dataEntityList = super.completionData(matrix.length, dataEntityList, columnItem.startTime, columnItem.getEndTime(), columnItem.granularity); |
| | | |
| | | /** 如果数据取不满,把缺失的数据点放在后面 */ |
| | | if (dataEntityList != null && dataEntityList.size() != 0) { |
| | | logger.info("设置matrix, i = " + i + ", size = " + dataEntityList.size()); |
| | | for (int k = 0; k < dataEntityList.size(); k++) { |
| | | matrix[k][i] = dataEntityList.get(k).getDataValue(); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | SampleData sampleData = new SampleData(); |
| | | sampleData.setMatrix(matrix); |
| | | sampleDataList.add(sampleData); |
| | | } |
| | | return sampleDataList; |
| | | } |
| | | |
| | | /** |
| | | * getData |
| | | * |
| | | * @param columnItem |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | private List<DataValueVO> getData(ColumnItem columnItem) throws Exception { |
| | | List<DataValueVO> dataList = new ArrayList<>(); |
| | | String paramType = columnItem.getParamType(); |
| | | switch (paramType) { |
| | | case "DATAPOINT": |
| | | ApiPointDTO point = dataPointApi.getPointById(columnItem.getId()); |
| | | ApiPointValueQueryDTO queryDto = new ApiPointValueQueryDTO(); |
| | | queryDto.setPointNo(point.getPointNo()); |
| | | queryDto.setStart(columnItem.getStartTime()); |
| | | queryDto.setEnd(columnItem.getEndTime()); |
| | | List<ApiPointValueDTO> pointValueList = dataPointApi.getValue(queryDto); |
| | | dataList = ConvertUtils.sourceToTarget(pointValueList, DataValueVO.class); |
| | | break; |
| | | case "PREDICTITEM": |
| | | MmItemOutputVO outPut = itemEntityFactory.getItemOutPutById(columnItem.getId()); |
| | | dataList = mmItemResultService.getPredictValue(outPut.getId(), |
| | | columnItem.getStartTime(), columnItem.getEndTime()); |
| | | if (dataList == null) { |
| | | throw new Exception("没有预测值"); |
| | | } |
| | | break; |
| | | |
| | | |
| | | default: |
| | | break; |
| | | } |
| | | return dataList; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample; |
| | | |
| | | import com.iailab.module.model.mcs.pre.entity.MmModelParamEntity; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictModelService; |
| | | import com.iailab.module.model.mdk.factory.ItemEntityFactory; |
| | | import com.iailab.module.model.mdk.factory.ModelEntityFactory; |
| | | import com.iailab.module.model.mdk.sample.dto.ColumnItem; |
| | | import com.iailab.module.model.mdk.sample.dto.ColumnItemPort; |
| | | import com.iailab.module.model.mdk.sample.dto.SampleInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月03日 |
| | | */ |
| | | @Component |
| | | public class PredictSampleInfoConstructor extends SampleInfoConstructor { |
| | | |
| | | @Autowired |
| | | private MmPredictModelService mmPredictModelService; |
| | | |
| | | @Autowired |
| | | private ModelEntityFactory modelEntityFactory; |
| | | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | @Override |
| | | public SampleInfo prepareSampleInfo(String modelId, Date predictTime) { |
| | | return super.prepareSampleInfo(modelId, predictTime); |
| | | } |
| | | |
| | | /** |
| | | * 返回样本矩阵的列数 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | @Override |
| | | protected Integer getSampleColumn(String modelId) { |
| | | return mmPredictModelService.getSampleLength(modelId).intValue(); |
| | | } |
| | | |
| | | /** |
| | | * 返回样本的开始时间 |
| | | * |
| | | * @param columnItem |
| | | * @param predictTime |
| | | * @return |
| | | */ |
| | | @Override |
| | | protected Date getStartTime(ColumnItem columnItem, Date predictTime) { |
| | | return super.getStartTime(columnItem, predictTime); |
| | | } |
| | | |
| | | /** |
| | | * 返回样本的结束时间 |
| | | * |
| | | * @param columnItem |
| | | * @param predictTime |
| | | * @return |
| | | */ |
| | | @Override |
| | | protected Date getEndTime(ColumnItem columnItem, Date predictTime) { |
| | | return super.getEndTime(columnItem, predictTime); |
| | | } |
| | | |
| | | /** |
| | | * 样本的列信息 |
| | | * |
| | | * @param modelId |
| | | * @param predictTime |
| | | * @return |
| | | */ |
| | | @Override |
| | | protected List<ColumnItemPort> getColumnInfo(String modelId, Date predictTime) { |
| | | List<ColumnItemPort> resultList = new ArrayList<>(); |
| | | List<ColumnItem> columnItemList = new ArrayList<>(); |
| | | ColumnItem columnInfo = new ColumnItem(); |
| | | ColumnItemPort curPort = new ColumnItemPort(); //当前端口 |
| | | List<MmModelParamEntity> modelInputParamEntityList = modelEntityFactory.getModelInputParam(modelId); |
| | | if (CollectionUtils.isEmpty(modelInputParamEntityList)) { |
| | | return null; |
| | | } |
| | | //设置当前端口号,初始值为最小端口(查询结果按端口号从小到达排列) |
| | | int curPortOrder = modelInputParamEntityList.get(0).getModelparamportorder(); |
| | | //设置当前查询数据长度,初始值为最小端口数据长度 |
| | | int curDataLength = modelInputParamEntityList.get(0).getDatalength(); |
| | | for (MmModelParamEntity entry : modelInputParamEntityList) { |
| | | columnInfo.setParamType(entry.getModelparamtype()); |
| | | columnInfo.setId(entry.getModelparamid()); |
| | | columnInfo.setDataLength(entry.getDatalength()); |
| | | columnInfo.setModelParamOrder(entry.getModelparamorder()); |
| | | columnInfo.setModelParamPortOrder(entry.getModelparamportorder()); |
| | | columnInfo.setStartTime(getStartTime(columnInfo, predictTime)); |
| | | columnInfo.setEndTime(getEndTime(columnInfo, predictTime)); |
| | | columnInfo.setGranularity(super.getGranularity(columnInfo)); |
| | | |
| | | //对每一个爪进行数据项归并 |
| | | if (curPortOrder != entry.getModelparamportorder()){ |
| | | //当数据项端口号不为当前端口号时,封装上一个端口类,操作下一个端口类 |
| | | curPort.setColumnItemList(columnItemList); |
| | | curPort.setDataLength(curDataLength); |
| | | curPort.setPortOrder(curPortOrder); |
| | | resultList.add(curPort); |
| | | curPort = new ColumnItemPort(); //对象重新初始化,防止引用拷贝导致数据覆盖 |
| | | //封装上一个端口类后更新当前的各个参数 |
| | | columnItemList = new ArrayList<>(); |
| | | curDataLength = entry.getDatalength(); |
| | | curPortOrder = entry.getModelparamportorder(); |
| | | } |
| | | columnItemList.add(columnInfo); |
| | | columnInfo = new ColumnItem(); //对象重新初始化,防止引用拷贝导致数据覆盖 |
| | | } |
| | | //当迭代到最后一个项的时候,封装最后一个端口的信息 |
| | | curPort.setColumnItemList(columnItemList); |
| | | curPort.setDataLength(curDataLength); |
| | | curPort.setPortOrder(curPortOrder); |
| | | resultList.add(curPort); |
| | | return resultList; |
| | | } |
| | | |
| | | /** |
| | | * 样本的采样周期 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | @Override |
| | | protected Integer getSampleCycle(String modelId) { |
| | | return itemEntityFactory.getItemById(modelEntityFactory.getModelEntity(modelId).getItemid()).getGranularity(); |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample; |
| | | |
| | | import com.iailab.module.model.mdk.common.exceptions.DataAccessException; |
| | | import com.iailab.module.model.mdk.sample.dto.SampleData; |
| | | import com.iailab.module.model.mdk.sample.dto.SampleInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.text.MessageFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 样本构造 |
| | | * |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月03日 |
| | | */ |
| | | @Component |
| | | public class SampleConstructor { |
| | | |
| | | @Autowired |
| | | private SampleFactory sampleFactory; |
| | | |
| | | public List<SampleData> constructSample(String typeA, String modelId, Date runTime) { |
| | | try { |
| | | SampleInfoConstructor sampleInfoConstructor = sampleFactory.createSampleInfo(typeA, modelId); |
| | | SampleInfo sampleInfo = sampleInfoConstructor.prepareSampleInfo(modelId, runTime); |
| | | SampleDataConstructor sampleDataConstructor = sampleFactory.createSampelData(typeA); |
| | | return sampleDataConstructor.prepareSampleData(sampleInfo); |
| | | } catch (Exception e) { |
| | | DataAccessException exception = new DataAccessException(MessageFormat.format("{0},类名为{1}", |
| | | DataAccessException.errorDataAccess, Thread.currentThread().getStackTrace()[1].getClassName())); |
| | | System.out.println(exception); |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample; |
| | | |
| | | 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.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | |
| | | abstract class SampleDataConstructor { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | /** |
| | | * prepareSampleData |
| | | * |
| | | * @param sampleInfo |
| | | * @return |
| | | */ |
| | | public abstract List<SampleData> prepareSampleData(SampleInfo sampleInfo); |
| | | |
| | | /** |
| | | * 补全数据 |
| | | * |
| | | * @param length |
| | | * @param dataEntityList |
| | | * @param startTime |
| | | * @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()) { |
| | | return dataEntityList; |
| | | } |
| | | logger.info("补全数据, length =" + length + "; size = " + dataEntityList.size() + "; startTime = " + startTime.getTime() + "; endTime = " + endTime.getTime()); |
| | | logger.info("补全前:" + dataEntityList); |
| | | |
| | | 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++) { |
| | | 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++; |
| | | lastItem = item; |
| | | |
| | | DataValueVO dataEntity = new DataValueVO(); |
| | | dataEntity.setDataTime(new Date(item.getKey())); |
| | | dataEntity.setDataValue(item.getValue()); |
| | | completionDataEntityList.add(dataEntity); |
| | | } |
| | | |
| | | logger.info("补全后:" + completionDataEntityList); |
| | | return completionDataEntityList; |
| | | } |
| | | |
| | | /** |
| | | * getFirstValue |
| | | * |
| | | * @param dataMap |
| | | * @return |
| | | */ |
| | | private Double getFirstValue(Map<Long, Double> dataMap) { |
| | | for (Map.Entry<Long, Double> item : dataMap.entrySet()) { |
| | | if (item.getValue() != null) { |
| | | return item.getValue(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample; |
| | | |
| | | import com.iailab.module.model.mdk.common.enums.TypeA; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 样本工厂 |
| | | */ |
| | | @Component |
| | | public class SampleFactory { |
| | | |
| | | @Autowired |
| | | private PredictSampleInfoConstructor predictSampleInfoConstructor; |
| | | |
| | | @Autowired |
| | | private PredictSampleDataConstructor predictSampleDataConstructor; |
| | | |
| | | /** |
| | | * add by zfc 2020.12.15 重写createSampleInfo方法:不区分算法类型直接返回预测时间序列类型 |
| | | * |
| | | * @param typeA |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | public SampleInfoConstructor createSampleInfo(String typeA, String modelId){ |
| | | PredictSampleInfoConstructor sampleInfoConstructor = null; |
| | | if (typeA.compareTo(TypeA.Predict.name()) == 0) { |
| | | sampleInfoConstructor = predictSampleInfoConstructor; |
| | | } |
| | | return sampleInfoConstructor; |
| | | } |
| | | |
| | | public SampleDataConstructor createSampelData(String typeA) { |
| | | SampleDataConstructor sampleDataConstructor = null; |
| | | if (typeA.compareTo(TypeA.Predict.name()) == 0) { |
| | | sampleDataConstructor = predictSampleDataConstructor; |
| | | } |
| | | return sampleDataConstructor; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | 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.DataPointFreq; |
| | | 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; |
| | | import com.iailab.module.model.mdk.sample.dto.SampleInfo; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月03日 |
| | | */ |
| | | abstract class SampleInfoConstructor { |
| | | |
| | | @Autowired |
| | | private DataPointApi dataPointApi; |
| | | |
| | | @Autowired |
| | | private ItemEntityFactory itemEntityFactory; |
| | | |
| | | /** |
| | | * prepareSampleInfo |
| | | * |
| | | * @param modelId |
| | | * @param predictTime |
| | | * @return |
| | | */ |
| | | public SampleInfo prepareSampleInfo(String modelId, Date predictTime) { |
| | | SampleInfo sampleInfo = new SampleInfo(); |
| | | //调用样本列数的方法 |
| | | sampleInfo.setSampleColumn(getSampleColumn(modelId)); |
| | | //样本的列信息 |
| | | sampleInfo.setColumnInfo(getColumnInfo(modelId, predictTime)); |
| | | //样本的采样周期 |
| | | sampleInfo.setSampleCycle(getSampleCycle(modelId)); |
| | | return sampleInfo; |
| | | } |
| | | |
| | | /** |
| | | * 返回样本矩阵的列数 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | protected abstract Integer getSampleColumn(String modelId); |
| | | |
| | | /** |
| | | * 获取开始时间 |
| | | * |
| | | * @param columnItem |
| | | * @param originalTime |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | protected Date getStartTime(ColumnItem columnItem, Date originalTime) { |
| | | Date dateTime = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(originalTime); |
| | | switch (columnItem.getParamType()) { |
| | | case "DATAPOINT": |
| | | ApiPointDTO dataPoint = dataPointApi.getPointById(columnItem.getParamId()); |
| | | if (dataPoint == null) { |
| | | return null; |
| | | } |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), DataPointFreq.getEumByCode(dataPoint.getMinfreqid()).getValue()); |
| | | break; |
| | | case "PREDICTITEM": |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | case "IND-HIS": |
| | | dateTime = calculateTime(originalTime, true, columnItem.getDataLength(), 60); |
| | | break; |
| | | case "IND-PLAN": |
| | | dateTime = calendar.getTime(); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dateTime; |
| | | } |
| | | |
| | | /** |
| | | * 获取结束时间 |
| | | * |
| | | * @param columnItem |
| | | * @param originalTime |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | protected Date getEndTime(ColumnItem columnItem, Date originalTime) { |
| | | Date dateTime = new Date(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(originalTime); |
| | | switch (columnItem.getParamType()) { |
| | | case "DATAPOINT": |
| | | ApiPointDTO dataPoint = dataPointApi.getPointById(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); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return dateTime; |
| | | } |
| | | |
| | | /** |
| | | * 获取粒度,s |
| | | * |
| | | * @param columnItem |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | protected Integer getGranularity(ColumnItem columnItem) { |
| | | Integer granularity = 60; |
| | | switch (columnItem.getParamType()) { |
| | | case "DATAPOINT": |
| | | ApiPointDTO dataPoint = dataPointApi.getPointById(columnItem.getParamId()); |
| | | granularity = DataPointFreq.getEumByCode(dataPoint.getMinfreqid()).getValue(); |
| | | break; |
| | | case "PREDICTITEM": |
| | | granularity = itemEntityFactory.getItemById(columnItem.getParamId()).getGranularity(); |
| | | break; |
| | | case "IND-HIS": |
| | | granularity = 60; |
| | | break; |
| | | case "IND-PLAN": |
| | | granularity = 60; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | return granularity; |
| | | } |
| | | |
| | | /** |
| | | * 样本的列信息 |
| | | * |
| | | * @param modelId |
| | | * @param predictTime |
| | | * @return |
| | | */ |
| | | protected abstract List<ColumnItemPort> getColumnInfo(String modelId, Date predictTime); |
| | | |
| | | /** |
| | | * 样本的采样周期 |
| | | * |
| | | * @param modelId |
| | | * @return |
| | | */ |
| | | protected abstract Integer getSampleCycle(String modelId); |
| | | |
| | | /** |
| | | * 计算取值的时间 |
| | | * |
| | | * @param originalTime |
| | | * @param backward |
| | | * @param dataLength |
| | | * @param granularity |
| | | * @return |
| | | */ |
| | | public Date calculateTime(Date originalTime, Boolean backward, int dataLength, int granularity) { |
| | | 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 * granularity); |
| | | return calendar.getTime(); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample.dto; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class ColumnItem { |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | public String id; |
| | | |
| | | /** |
| | | * 参数类型 |
| | | */ |
| | | public String paramType; |
| | | |
| | | /** |
| | | * 参数ID |
| | | */ |
| | | public String paramId; |
| | | |
| | | /** |
| | | * 数据长度 |
| | | */ |
| | | public int dataLength; |
| | | |
| | | /** |
| | | * 模型参数排序 |
| | | */ |
| | | public int modelParamOrder; |
| | | |
| | | /** |
| | | * 模型参数端口排序 |
| | | */ |
| | | public int modelParamPortOrder; |
| | | |
| | | /** |
| | | * 采样的开始时间 |
| | | */ |
| | | public Date startTime; |
| | | |
| | | /** |
| | | * 采样的结束时间 |
| | | */ |
| | | public Date endTime; |
| | | |
| | | /** |
| | | * 采样粒度,s |
| | | */ |
| | | public int granularity; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample.dto; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * add by zfc 2020.11.25 用于对每个爪的Column进行归类 |
| | | */ |
| | | @Data |
| | | @Builder |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class ColumnItemPort { |
| | | /** |
| | | * 爪内数据项的列表 |
| | | */ |
| | | private List<ColumnItem> columnItemList; |
| | | |
| | | /** |
| | | * 爪的端口号 |
| | | */ |
| | | private int portOrder; |
| | | |
| | | /** |
| | | * 预测数据长度 |
| | | */ |
| | | private int dataLength; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample.dto; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class SampleData { |
| | | private double[][] matrix; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.sample.dto; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class SampleInfo { |
| | | /** |
| | | * 用于记录端口的个数(爪的个数) |
| | | */ |
| | | private Integer portLength; |
| | | |
| | | private Integer sampleColumn; |
| | | |
| | | private Timestamp startTime; |
| | | |
| | | private Timestamp endTime; |
| | | |
| | | private List<ColumnItemPort> columnInfo; |
| | | |
| | | private Integer sampleCycle; |
| | | |
| | | private BigDecimal[][] deviation; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月02日 |
| | | */ |
| | | @Data |
| | | public class DataValueVO { |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | private Date dataTime; |
| | | |
| | | /** |
| | | * 数值 |
| | | */ |
| | | private Double dataValue; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月01日 |
| | | */ |
| | | @Data |
| | | public class ItemVO { |
| | | private String id; |
| | | private String itemNo; |
| | | private String itemName; |
| | | private String itemType; |
| | | private Integer predictLength; |
| | | private Integer granularity; |
| | | private Integer status; |
| | | private Integer isFuse; |
| | | private Integer predictPhase; |
| | | private Integer workChecked; |
| | | private Integer isDisplay; |
| | | private Integer unitTransFactor; |
| | | |
| | | /** |
| | | * 保留的预测点位 (T+2 则n=2, T+30则n=30, T+n则表示从最后点位开始,n=预测长度;n由系统配置得出) |
| | | */ |
| | | private String saveIndex; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class MergeItemVO { |
| | | private String id; |
| | | private String itemId; |
| | | private String expression; |
| | | private String itemNo; |
| | | private Integer num; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @Description |
| | | * @createTime 2024年09月02日 |
| | | */ |
| | | @Data |
| | | public class MmItemOutputVO { |
| | | private String id; |
| | | private String itemId; |
| | | private String pointId; |
| | | private String resultTableName; |
| | | private Integer order; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 模型算法参数实体 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class ModelArithParamVO { |
| | | /** |
| | | * 算法参数名称 |
| | | */ |
| | | private String arithParamName; |
| | | |
| | | /** |
| | | * 算法参数类型 |
| | | */ |
| | | private String arithParamType; |
| | | |
| | | /** |
| | | * 算法参数值 |
| | | */ |
| | | private String arithParamValue; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * 模型输入参数实体 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class ModelInputParamVO { |
| | | /** |
| | | * 模型输入参数名称 |
| | | */ |
| | | private String modelParamName; |
| | | |
| | | /** |
| | | * 模型输入参数类型 |
| | | */ |
| | | private String modelParamType; |
| | | |
| | | /** |
| | | * 模型输入参数的ID(PREDICTITEM类型的为ITEMID,DATAPOINT类型的为POINTDID) |
| | | */ |
| | | private String modelParamId; |
| | | |
| | | /** |
| | | * 模型输入参数的顺序 |
| | | */ |
| | | private Integer modelParamOrder; |
| | | |
| | | /** |
| | | * 模型参数对应的爪的顺序 |
| | | * add by zfc 2020.11.24 添加模型参数对应的爪的order |
| | | */ |
| | | private int modelParamPortOrder; |
| | | |
| | | /** |
| | | * 预测数据长度 |
| | | */ |
| | | private int dataLength; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 模型实体 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class ModelVO { |
| | | /** |
| | | * 模型ID |
| | | */ |
| | | private String id; |
| | | |
| | | /** |
| | | * 模型编号 |
| | | */ |
| | | private String modelNo; |
| | | |
| | | /** |
| | | * 模型名称 |
| | | */ |
| | | private String modelName; |
| | | |
| | | /** |
| | | * 预测项ID |
| | | */ |
| | | private String itemId; |
| | | |
| | | /** |
| | | * 算法ID |
| | | */ |
| | | private String arithId; |
| | | |
| | | /** |
| | | * 训练样本长度 |
| | | */ |
| | | private Integer trainSampleLength; |
| | | |
| | | /** |
| | | * 预测样本长度 |
| | | */ |
| | | private Integer predictSampleLength; |
| | | |
| | | /** |
| | | * 是否在线训练 |
| | | */ |
| | | private Integer isOnlineTrain; |
| | | |
| | | /** |
| | | * 模型路径 |
| | | */ |
| | | private String modelPath; |
| | | |
| | | /** |
| | | * 是否归一化 |
| | | */ |
| | | private Integer isNormal; |
| | | |
| | | /** |
| | | * 归一化后的最大值 |
| | | */ |
| | | private Double normalMax; |
| | | |
| | | /** |
| | | * 归一化后的最小值 |
| | | */ |
| | | private Double normalMin; |
| | | |
| | | /** |
| | | * 是否参与预测 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 类名称 |
| | | */ |
| | | private String className; |
| | | |
| | | /** |
| | | * 方法名称 |
| | | */ |
| | | private String methodName; |
| | | |
| | | /** |
| | | * 模型构造器 |
| | | */ |
| | | private String modelParamStructure; |
| | | |
| | | /** |
| | | * 结果ID |
| | | */ |
| | | private String resultstrid; |
| | | |
| | | /** |
| | | * settingMap |
| | | */ |
| | | private String settingMap; |
| | | |
| | | /** |
| | | * 训练模型路径 |
| | | */ |
| | | private String trainModelPath; |
| | | |
| | | /** |
| | | * 模型路径状态(1:需要更换,0:不需要更换) |
| | | */ |
| | | private BigDecimal pathStatus; |
| | | |
| | | /** |
| | | * 预测阶段需要输入的数据长度 |
| | | */ |
| | | private Integer pdim; |
| | | } |
对比新文件 |
| | |
| | | package com.iailab.module.model.mdk.vo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | @Builder |
| | | public class PredictResultVO { |
| | | |
| | | /** |
| | | * 如果是单独预测项,则predictID=itemID;如果是模块,则predictID=moduleID |
| | | */ |
| | | private String predictId; |
| | | |
| | | /** |
| | | * 预测的时间 |
| | | */ |
| | | private Date predictTime; |
| | | |
| | | /** |
| | | * 统一预测入口的预测类型(循环调用、手动调用) |
| | | */ |
| | | private double[][] predictMatrix; |
| | | |
| | | /** |
| | | * 时间间隔 (当前预测时间 与 上一次预测时间 相差的分钟数;系统计算得出) |
| | | */ |
| | | private int t; |
| | | |
| | | /** |
| | | * 时间间隔 (当前预测时间 与 上一次预测时间 相差的分钟数;系统计算得出) |
| | | */ |
| | | private int lt; |
| | | |
| | | /** |
| | | * 保留的预测点位 (T+2 则n=2, T+30则n=30, T+n则表示从最后点位开始,n=预测长度;n由系统配置得出) |
| | | */ |
| | | private String saveIndex; |
| | | |
| | | /** |
| | | * 预测集合 |
| | | */ |
| | | private List<DataValueVO> predictList; |
| | | } |
对比新文件 |
| | |
| | | #dev |
| | | #mdk-init-path = D:\\DLUT\\MDK\\libs\\ |
| | | #prod |
| | | mdk-init-path = D:\\SmartEnergyStudio\\IAILMDK\\libs\\ |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.iailab.module.model.mcs.pre.dao.MmItemOutputDao"> |
| | | |
| | | <resultMap id="MmItemOutputVO" type="com.iailab.module.model.mdk.vo.MmItemOutputVO"> |
| | | <result property="id" column="ID"/> |
| | | <result property="itemId" column="ITEMID"/> |
| | | <result property="pointId" column="POINTID"/> |
| | | <result property="resultTableName" column="TABLENAME"/> |
| | | <result property="order" column="OUTPUTORDER"/> |
| | | </resultMap> |
| | | |
| | | <select id="getOutPutById" resultMap="MmItemOutputVO"> |
| | | SELECT t1.id, |
| | | t1.itemid, |
| | | t1.pointid, |
| | | t2.tablename, |
| | | t1.outputorder |
| | | FROM t_mm_item_output t1, |
| | | t_mm_result_table t2 |
| | | WHERE t1.id = #{value} |
| | | AND t1.resulttableid = t2.id |
| | | </select> |
| | | <select id="getOutPutByItemId" resultMap="MmItemOutputVO"> |
| | | SELECT t1.id, |
| | | t1.itemid, |
| | | t1.pointid, |
| | | t2.tablename, |
| | | t1.outputorder |
| | | FROM t_mm_item_output t1, |
| | | t_mm_result_table t2 |
| | | WHERE t1.itemid = #{value} |
| | | AND t1.resulttableid = t2.id |
| | | ORDER BY t1.outputorder |
| | | </select> |
| | | <select id="getOutPutByPointId" resultMap="MmItemOutputVO"> |
| | | SELECT t1.id, |
| | | t1.itemid, |
| | | t1.pointid, |
| | | t2.tablename, |
| | | t1.outputorder |
| | | FROM t_mm_item_output t1, |
| | | t_mm_result_table t2 |
| | | WHERE t1.pointid = #{value} |
| | | AND t1.resulttableid = t2.id |
| | | ORDER BY t1.outputorder |
| | | </select> |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | |
| | | <mapper namespace="com.iailab.module.model.mcs.pre.dao.MmItemResultDao"> |
| | | |
| | | <delete id="deletePredictValue" parameterType="map"> |
| | | DELETE |
| | | FROM ${TABLENAME} |
| | | WHERE outputid = #{OUTPUTID} |
| | | AND datatime |
| | | BETWEEN #{STARTTIME} |
| | | AND #{ENDTIME} |
| | | </delete> |
| | | |
| | | <insert id="savePredictValue" parameterType="map"> |
| | | INSERT INTO ${TABLENAME} |
| | | (id,outputid,datatime,datavalue) |
| | | VALUES |
| | | <foreach item="item" collection="list" separator=","> |
| | | (#{item.id},#{item.outputId},#{item.dataTime},#{item.dataValue}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <insert id="savePredictJsonValue" parameterType="map"> |
| | | INSERT INTO ${TABLENAME} |
| | | (id,outputid,predicttime,jsonvalue,cumulant) |
| | | VALUES (#{entity.id},#{entity.outputid},#{entity.predicttime},#{entity.jsonvalue},#{entity.cumulant}) |
| | | </insert> |
| | | |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.iailab.module.model.mcs.pre.dao.MmItemTypeDao"> |
| | | |
| | | <resultMap id="MmItemTypeEntity" type="com.iailab.module.model.mcs.pre.entity.MmItemTypeEntity"> |
| | | <result property="itemtypename" column="ITEMTYPENAME"/> |
| | | <result property="itemclasstype" column="ITEMCLASSTYPE"/> |
| | | <result property="assemblyname" column="ASSEMBLYNAME"/> |
| | | </resultMap> |
| | | |
| | | <select id="getItemTypeByItemId" resultMap="MmItemTypeEntity"> |
| | | SELECT |
| | | t2.itemtypename, |
| | | t2.itemclasstype, |
| | | t2.assemblyname |
| | | FROM |
| | | t_mm_predict_item t1, |
| | | t_mm_item_type t2 |
| | | WHERE t1.itemtypeid=t2.id |
| | | AND t1.id=#{value} |
| | | </select> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.iailab.module.model.mcs.pre.dao.MmPredictItemDao"> |
| | | |
| | | <resultMap id="ItemVO" type="com.iailab.module.model.mdk.vo.ItemVO"> |
| | | <result property="id" column="ID"/> |
| | | <result property="itemNo" column="ITEMNO"/> |
| | | <result property="itemName" column="ITEMNAME"/> |
| | | <result property="itemType" column="ITEMTYPENAME"/> |
| | | <result property="predictLength" column="PREDICTLENGTH"/> |
| | | <result property="granularity" column="GRANULARITY"/> |
| | | <result property="status" column="STATUS"/> |
| | | <result property="isFuse" column="ISFUSE"/> |
| | | <result property="predictPhase" column="PREDICTPHASE"/> |
| | | <result property="workChecked" column="WORKCHECKED"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="MergeItemVO" type="com.iailab.module.model.mdk.vo.MergeItemVO"> |
| | | <result property="id" column="ID"/> |
| | | <result property="itemId" column="ITEMID"/> |
| | | <result property="expression" column="EXPRESSION"/> |
| | | </resultMap> |
| | | |
| | | <select id="queryList" resultType="com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO" parameterType="map"> |
| | | SELECT |
| | | TMPI.ID, |
| | | TMPI.ITEMNO, |
| | | TMPI.ITEMNAME, |
| | | TMPI.ITEMTYPEID, |
| | | TMIT.ITEMTYPENAME, |
| | | TMPI.GRANULARITY, |
| | | TMPI.ISFUSE, |
| | | TMPI.WORKCHECKED, |
| | | TDMI.MODULEID, |
| | | TDMI.ITEMORDER, |
| | | TDMI.STATUS, |
| | | TDMI.CATEGORYID, |
| | | TMIO.POINTID, |
| | | TMIO.TAGNAME, |
| | | TMIO.RESULTTABLEID, |
| | | TMRT.TABLENAME |
| | | 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="params.itemno != null and params.itemno != ''"> |
| | | AND TMPI.ITEMNO LIKE CONCAT('%', #{params.itemno},'%') |
| | | </if> |
| | | <if test="params.itemname != null and params.itemname != ''"> |
| | | AND TMPI.ITEMNAME LIKE CONCAT('%', #{params.itemname},'%') |
| | | </if> |
| | | <if test="params.itemtypeid != null and params.itemtypeid != ''"> |
| | | AND TMPI.ITEMTYPEID = #{params.itemtypeid} |
| | | </if> |
| | | <if test="params.itemtypename != null and params.itemtypename != ''"> |
| | | AND TMIT.ITEMTYPENAME = #{params.itemtypename} |
| | | </if> |
| | | <if test="params.status != null and params.status != ''"> |
| | | AND TDMI.STATUS = #{params.status} |
| | | </if> |
| | | ORDER BY TMPI.CREATE_TIME DESC |
| | | </select> |
| | | |
| | | <select id="getByModuleId" parameterType="map" resultMap="ItemVO"> |
| | | SELECT t1.id, |
| | | t1.itemno, |
| | | t1.itemname, |
| | | t3.itemtypename, |
| | | t1.predictlength, |
| | | t1.granularity, |
| | | t1.status, |
| | | t1.isfuse, |
| | | t1.workchecked, |
| | | t1.unittransfactor |
| | | FROM t_mm_predict_item t1, |
| | | t_dm_module_item t2, |
| | | t_mm_item_type t3 |
| | | WHERE t1.id = t2.itemid |
| | | AND t1.itemtypeid = t3.id |
| | | AND t2.moduleid = #{MODULEID} |
| | | AND t2.status = 1 |
| | | AND t1.status = 1 |
| | | ORDER BY t2.itemorder |
| | | </select> |
| | | |
| | | <select id="getItem" parameterType="map" resultMap="ItemVO"> |
| | | SELECT |
| | | t1.id, |
| | | t1.itemno , |
| | | t1.itemname , |
| | | t1.predictlength , |
| | | t2.itemtypename, |
| | | t1.granularity, |
| | | t1.status, |
| | | t1.isfuse, |
| | | t1.predictphase, |
| | | t1.workchecked |
| | | FROM |
| | | ${TABLESCHEMA}.t_mm_predict_item t1, |
| | | ${TABLESCHEMA}.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> |
| | | </select> |
| | | <select id="getMergeItemByItemId" parameterType="map" resultMap="MergeItemVO"> |
| | | SELECT t1.id, |
| | | t1.itemid, |
| | | t1.expression |
| | | FROM t_mm_predict_merge_item t1 |
| | | WHERE t1.itemid = #{ITEMID} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.iailab.module.model.mcs.pre.dao.MmPredictModelDao"> |
| | | |
| | | <select id="getActiveModelByItemId" resultMap="com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity"> |
| | | SELECT |
| | | t.* |
| | | FROM |
| | | t_mm_predict_model t |
| | | WHERE status=1 |
| | | AND itemid=#{value} |
| | | </select> |
| | | |
| | | |
| | | <select id="getSampleLength" resultMap="com.iailab.module.model.mcs.pre.entity.MmPredictModelEntity"> |
| | | SELECT |
| | | t.predictsamplength |
| | | FROM |
| | | t_mm_predict_model t |
| | | WHERE status=1 |
| | | AND id=#{value} |
| | | </select> |
| | | |
| | | |
| | | |
| | | </mapper> |