55 changed files with 1740 additions and 82 deletions
@ -0,0 +1,32 @@ |
|||
package cn.iocoder.yudao.module.alert.common.enums; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
|
|||
import java.util.Objects; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 14:07 |
|||
*/ |
|||
@AllArgsConstructor |
|||
public enum Algorithm { |
|||
/** |
|||
* 模型算法枚举 |
|||
*/ |
|||
ERROR(-1), |
|||
PCA(0), |
|||
ANN(1); |
|||
|
|||
public final Integer code; |
|||
|
|||
|
|||
public static Algorithm of(Integer code) { |
|||
for (Algorithm algorithm : values()) { |
|||
if (Objects.equals(algorithm.code, code)) { |
|||
return algorithm; |
|||
} |
|||
} |
|||
return ERROR; |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package cn.iocoder.yudao.module.alert.common.enums; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 13:48 |
|||
*/ |
|||
@AllArgsConstructor |
|||
public enum ModelStatus { |
|||
/** |
|||
* 模型状态 |
|||
*/ |
|||
TRAINING(0, "训练中"), |
|||
FINISH(1, "已下装"); |
|||
|
|||
|
|||
public final Integer code; |
|||
|
|||
public final String desc; |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package cn.iocoder.yudao.module.alert.common.enums; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 13:53 |
|||
*/ |
|||
@AllArgsConstructor |
|||
public enum ModelTrash { |
|||
/** |
|||
* 删除状态 |
|||
*/ |
|||
NORMAL(0, "正常"), |
|||
TRASH(1, "已删除"), |
|||
; |
|||
public final Integer code; |
|||
|
|||
public final String desc; |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package cn.iocoder.yudao.module.alert.common.enums; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 14:00 |
|||
*/ |
|||
@AllArgsConstructor |
|||
public enum ModelVisible { |
|||
/** |
|||
* 模型可见状态 |
|||
*/ |
|||
VISIBLE(1), |
|||
INVISIBLE(0), |
|||
; |
|||
public final Integer code; |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.exa.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-20 20:45 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ExaPoint { |
|||
/** |
|||
* 点号 |
|||
*/ |
|||
@JsonProperty("ItemName") |
|||
private String itemName; |
|||
/** |
|||
* |
|||
*/ |
|||
@JsonProperty("SerialNumber") |
|||
private int serialNumber; |
|||
/** |
|||
* 组名 |
|||
*/ |
|||
@JsonProperty("GroupName") |
|||
private String groupName; |
|||
/** |
|||
* 类型 |
|||
*/ |
|||
@JsonProperty("ItemType") |
|||
private int itemType; |
|||
/** |
|||
* 描述 |
|||
*/ |
|||
@JsonProperty("Descriptor") |
|||
private String descriptor; |
|||
/** |
|||
* 单位 |
|||
*/ |
|||
@JsonProperty("EngUnits") |
|||
private String engUnits; |
|||
/** |
|||
* 上限 |
|||
*/ |
|||
@JsonProperty("UpperLimit") |
|||
private Double upperLimit; |
|||
/** |
|||
* 下限 |
|||
*/ |
|||
@JsonProperty("LowerLimit") |
|||
private Double lowerLimit; |
|||
/** |
|||
* 上边界 |
|||
*/ |
|||
@JsonProperty("LowerBound") |
|||
private Double lowerBound; |
|||
/** |
|||
* 下变价 |
|||
*/ |
|||
@JsonProperty("UpperBound") |
|||
private Double upperBound; |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelInfoVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelSelectQuery; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelSimpleVO; |
|||
import cn.iocoder.yudao.module.alert.service.model.ModelService; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
import java.util.Objects; |
|||
|
|||
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 13:07 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/alert/model") |
|||
public class ModelController { |
|||
private final ModelService modelService; |
|||
|
|||
|
|||
@GetMapping("/card/list") |
|||
public CommonResult<List<ModelSimpleVO>> getModelList(ModelSelectQuery query) { |
|||
List<ModelSimpleVO> modelList = modelService.getModelList(query); |
|||
return CommonResult.success(modelList); |
|||
} |
|||
|
|||
@GetMapping("info/{id}") |
|||
public CommonResult<ModelInfoVO> getModelInfo(@PathVariable Integer id) { |
|||
ModelInfoVO modelInfo = modelService.getModelInfo(id); |
|||
return CommonResult.success(modelInfo); |
|||
} |
|||
|
|||
@PostMapping("/") |
|||
public CommonResult<Integer> saveModel(@RequestBody ModelInfoVO model) { |
|||
Integer id = modelService.createModel(model); |
|||
if (Objects.nonNull(id) && id > 0) { |
|||
return CommonResult.success(id); |
|||
} |
|||
return CommonResult.error(INTERNAL_SERVER_ERROR.getCode(), "新建模型异常"); |
|||
} |
|||
|
|||
@PatchMapping("/info") |
|||
public CommonResult<Boolean> updateModelInfo(@RequestBody ModelInfoVO vo) { |
|||
Boolean b = modelService.updateModelInfo(vo); |
|||
return CommonResult.success(b); |
|||
} |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelDataQuery; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelDataVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.TimeRange; |
|||
import cn.iocoder.yudao.module.alert.service.model.ModelDataService; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-09-05 22:08 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/alert/model/data") |
|||
public class ModelDataController { |
|||
private final ModelDataService modelDataService; |
|||
|
|||
|
|||
@GetMapping("/{id}") |
|||
public CommonResult<ModelDataVO> getModelData(@PathVariable Integer id, ModelDataQuery query) { |
|||
return CommonResult.success(null); |
|||
} |
|||
|
|||
@PostMapping("/calculate/{id}") |
|||
public CommonResult<Boolean> calculate(@PathVariable Integer id, @RequestBody TimeRange timeRange) { |
|||
return CommonResult.success(null); |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.model; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.*; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 23:02 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ModelInfo { |
|||
/** |
|||
* id |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String creator; |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String modelName; |
|||
|
|||
|
|||
|
|||
private List<Point> pointInfo; |
|||
|
|||
private String condition; |
|||
|
|||
private Integer sampling; |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.model; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import lombok.*; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 22:48 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class Point { |
|||
/** |
|||
* 系统名称 |
|||
*/ |
|||
private String systemName; |
|||
|
|||
/** |
|||
* 目标点号 |
|||
*/ |
|||
private String point; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
private String description; |
|||
|
|||
/** |
|||
* 单位 |
|||
*/ |
|||
private String unit; |
|||
|
|||
/** |
|||
* 上限 |
|||
*/ |
|||
private BigDecimal upperlimit; |
|||
|
|||
/** |
|||
* 下限 |
|||
*/ |
|||
private BigDecimal lowerlimit; |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-20 22:57 |
|||
*/ |
|||
@Data |
|||
public class CreateModelInfo { |
|||
private Integer systemId; |
|||
private ModelInfoVO modelInfo; |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import lombok.Data; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-09-15 22:52 |
|||
*/ |
|||
@Data |
|||
public class ModelDataQuery { |
|||
private String type; |
|||
@NotBlank |
|||
private String index; |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date st; |
|||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date et; |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.vo; |
|||
|
|||
import lombok.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-09-05 22:50 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ModelDataVO { |
|||
/** |
|||
* 目标数值 |
|||
*/ |
|||
private List<Double> targetValue; |
|||
/** |
|||
* 参数个数 |
|||
*/ |
|||
private int[] sampleValue; |
|||
/** |
|||
* 边界数据 |
|||
*/ |
|||
private List<List<Double>> dataList; |
|||
|
|||
/** |
|||
* 热力图数据 |
|||
*/ |
|||
private List<int[]> heatData; |
|||
} |
|||
@ -0,0 +1,90 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.vo; |
|||
|
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.model.Point; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.*; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 22:41 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ModelInfoVO { |
|||
/** |
|||
* id |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String creator; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
|
|||
/** |
|||
* 运行条件 |
|||
*/ |
|||
private String condition; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String modelName; |
|||
|
|||
|
|||
private List<Point> pointInfo; |
|||
|
|||
private List<TrainTime> trainTime; |
|||
|
|||
private Integer algorithmId; |
|||
|
|||
private Integer systemId; |
|||
|
|||
private Integer sampling; |
|||
|
|||
@Data |
|||
public static class TrainTime { |
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
private String st; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
private String et; |
|||
|
|||
/** |
|||
* 时长(秒) |
|||
*/ |
|||
private Integer duration; |
|||
|
|||
/** |
|||
* 采样数量 |
|||
*/ |
|||
private Integer number; |
|||
|
|||
/** |
|||
* 清洗样本数 |
|||
*/ |
|||
private Integer filter; |
|||
|
|||
/** |
|||
* 有效样本数 |
|||
*/ |
|||
private Integer mode; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 13:25 |
|||
*/ |
|||
@Data |
|||
public class ModelSelectQuery { |
|||
/** |
|||
* 机组id |
|||
*/ |
|||
private Integer unitId; |
|||
/** |
|||
* 系统id |
|||
*/ |
|||
private Integer typeId; |
|||
/** |
|||
* 子系统id |
|||
*/ |
|||
private Integer systemId; |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* @see seu.powersis.alert.common.enums.ModelStatus |
|||
* 模型状态 |
|||
*/ |
|||
private Integer status; |
|||
|
|||
/** |
|||
* @see seu.powersis.alert.common.enums.ModelTrash |
|||
* 可见状态 |
|||
*/ |
|||
private Integer visible; |
|||
|
|||
/** |
|||
* @see seu.powersis.alert.common.enums.ModelTrash |
|||
* 删除状态 |
|||
*/ |
|||
private Integer trash; |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.ToString; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 13:08 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@AllArgsConstructor |
|||
public class ModelSimpleVO { |
|||
/** |
|||
* 模型id |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 模型名称 |
|||
*/ |
|||
private String name; |
|||
/** |
|||
* 算法名称 |
|||
*/ |
|||
private String algorithm; |
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String creator; |
|||
|
|||
/** |
|||
* 模型状态 |
|||
*/ |
|||
private Integer status; |
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime; |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.vo; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.ToString; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 22:48 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@AllArgsConstructor |
|||
public class PointVO { |
|||
/** |
|||
* 系统名称 |
|||
*/ |
|||
private String systemName; |
|||
|
|||
/** |
|||
* 目标点号 |
|||
*/ |
|||
private String targetPoint; |
|||
|
|||
/** |
|||
* 描述 |
|||
*/ |
|||
private String description; |
|||
|
|||
/** |
|||
* 单位 |
|||
*/ |
|||
private String unit; |
|||
|
|||
/** |
|||
* 类型 |
|||
*/ |
|||
private String marktype; |
|||
|
|||
/** |
|||
* 上限 |
|||
*/ |
|||
private BigDecimal upperlimit; |
|||
|
|||
/** |
|||
* 下限 |
|||
*/ |
|||
private BigDecimal lowerlimit; |
|||
|
|||
/** |
|||
* 网格数 |
|||
*/ |
|||
private Integer gridNumber; |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.model.vo; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-09-15 22:33 |
|||
*/ |
|||
@Data |
|||
public class TimeRange { |
|||
private Date st; |
|||
private Date et; |
|||
} |
|||
@ -0,0 +1,56 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.system; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.OptionItemVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.SelectQuery; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.PointOptionItemVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.SelectAllOptionVO; |
|||
import cn.iocoder.yudao.module.alert.service.exa.EXAService; |
|||
import cn.iocoder.yudao.module.alert.service.system.SelectService; |
|||
import jakarta.validation.Valid; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.util.StringUtils; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-16 22:37 |
|||
*/ |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/alert/select") |
|||
public class SelectController { |
|||
/** |
|||
* 查询条件不能含有这个,否则exa会挂掉 |
|||
*/ |
|||
private static final String EXA_NOT_SUPPORT_STR = "'"; |
|||
private final SelectService selectService; |
|||
|
|||
private final EXAService exaService; |
|||
|
|||
@GetMapping("list") |
|||
public CommonResult<SelectAllOptionVO> getAllOptions() { |
|||
SelectAllOptionVO allOptions = selectService.getAllOptions(); |
|||
return CommonResult.success(allOptions); |
|||
} |
|||
|
|||
@GetMapping("/system/options") |
|||
public CommonResult<List<OptionItemVO>> getTypeOptions(@Valid SelectQuery query) { |
|||
List<OptionItemVO> systemOptions = selectService.getSystemOptions(query); |
|||
return CommonResult.success(systemOptions); |
|||
} |
|||
|
|||
@GetMapping("/point/options") |
|||
public CommonResult<List<PointOptionItemVO>> getPointOptions(String keyword) { |
|||
List<PointOptionItemVO> pointOptionList = new ArrayList<>(); |
|||
if (StringUtils.hasText(keyword) && !keyword.contains(EXA_NOT_SUPPORT_STR)) { |
|||
pointOptionList = exaService.getPointOptionList(keyword); |
|||
} |
|||
return CommonResult.success(pointOptionList); |
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.system.vo; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.ToString; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-16 22:39 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@AllArgsConstructor |
|||
public class OptionItemVO { |
|||
/** |
|||
* id |
|||
*/ |
|||
private Integer id; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.system.vo; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.ToString; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-20 20:55 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@AllArgsConstructor |
|||
public class PointOptionItemVO { |
|||
private String id; |
|||
|
|||
private String name; |
|||
} |
|||
@ -0,0 +1,32 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.system.vo; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.ToString; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-16 22:38 |
|||
*/ |
|||
@Data |
|||
@Builder |
|||
@ToString |
|||
@AllArgsConstructor |
|||
public class SelectAllOptionVO { |
|||
/** |
|||
* 机组选项 |
|||
*/ |
|||
private List<OptionItemVO> units; |
|||
/** |
|||
* 系统选项 |
|||
*/ |
|||
private List<OptionItemVO> types; |
|||
/** |
|||
* 子系统选项 |
|||
*/ |
|||
private List<OptionItemVO> systems; |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package cn.iocoder.yudao.module.alert.controller.admin.system.vo; |
|||
|
|||
import jakarta.validation.constraints.NotNull; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-17 23:48 |
|||
*/ |
|||
@Data |
|||
public class SelectQuery { |
|||
@NotNull |
|||
private Integer unitId; |
|||
@NotNull |
|||
private Integer typeId; |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @TableName model_cfg |
|||
*/ |
|||
@TableName(value = "model_cfg") |
|||
@Data |
|||
@Builder |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class ModelCfg implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
private Integer id; |
|||
private Integer systemId; |
|||
private Integer algorithmId; |
|||
private String modelName; |
|||
private Date creatTime; |
|||
private String creatName; |
|||
private String modelInfo; |
|||
private Integer status; |
|||
private Integer visible; |
|||
private String conditionInfo; |
|||
private Integer trash; |
|||
private String assessRes; |
|||
private Integer needToAssess; |
|||
private Double score; |
|||
private String clearOrNot; |
|||
private Integer effNumber; |
|||
private Integer needToClean; |
|||
private String origAssessRes; |
|||
private Double loadCover; |
|||
private String coverOutput; |
|||
private String curVersion; |
|||
private String modelVersion; |
|||
private String versionInfo; |
|||
private String conditionName; |
|||
private Integer isOnline; |
|||
private Integer trainStatus; |
|||
private String creator; |
|||
private Date createTime; |
|||
private String updater; |
|||
private Date updateTime; |
|||
private Boolean deleted; |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @TableName system_cfg |
|||
*/ |
|||
@TableName(value ="system_cfg") |
|||
@Data |
|||
public class SystemCfg implements Serializable { |
|||
private Integer systemId; |
|||
|
|||
private Integer systemTypeId; |
|||
|
|||
private String systemName; |
|||
|
|||
private String systemShortname; |
|||
|
|||
private Integer unitId; |
|||
|
|||
private String resetpoint; |
|||
|
|||
private Date resettime; |
|||
|
|||
private String resetlist; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import java.io.Serializable; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @TableName system_type_cfg |
|||
*/ |
|||
@TableName(value ="system_type_cfg") |
|||
@Data |
|||
public class SystemTypeCfg implements Serializable { |
|||
private Integer systemTypeId; |
|||
|
|||
private String systemTypeName; |
|||
|
|||
private String systemTypeShortname; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.domain; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import java.io.Serializable; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @TableName unit_cfg |
|||
*/ |
|||
@TableName(value ="unit_cfg") |
|||
@Data |
|||
public class UnitCfg implements Serializable { |
|||
private Integer unitId; |
|||
|
|||
private Integer plantId; |
|||
|
|||
private String unitName; |
|||
|
|||
private String unitShortname; |
|||
|
|||
private String alertBasicSample; |
|||
|
|||
private String loadpoint; |
|||
|
|||
private String temppoint; |
|||
|
|||
private Integer capacity; |
|||
|
|||
private String zqylqx; |
|||
|
|||
private String zqylMeasured; |
|||
|
|||
private String zqylTarget; |
|||
|
|||
private String datas; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.mapper; |
|||
|
|||
import cn.iocoder.yudao.module.alert.dao.domain.ModelCfg; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【model_cfg】的数据库操作Mapper |
|||
* @createDate 2025-05-22 15:45:38 |
|||
* @Entity cn.iocoder.yudao.module.alert.dao.domain.ModelCfg |
|||
*/ |
|||
public interface ModelCfgMapper extends BaseMapper<ModelCfg> { |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,18 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.mapper; |
|||
|
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemCfg; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【system_cfg】的数据库操作Mapper |
|||
* @createDate 2025-05-21 16:10:38 |
|||
* @Entity cn.iocoder.yudao.module.alert.dao.domain.SystemCfg |
|||
*/ |
|||
public interface SystemCfgMapper extends BaseMapper<SystemCfg> { |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,18 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.mapper; |
|||
|
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemTypeCfg; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【system_type_cfg】的数据库操作Mapper |
|||
* @createDate 2025-05-21 16:10:57 |
|||
* @Entity cn.iocoder.yudao.module.alert.dao.domain.SystemTypeCfg |
|||
*/ |
|||
public interface SystemTypeCfgMapper extends BaseMapper<SystemTypeCfg> { |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,18 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.mapper; |
|||
|
|||
import cn.iocoder.yudao.module.alert.dao.domain.UnitCfg; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【unit_cfg】的数据库操作Mapper |
|||
* @createDate 2025-05-21 16:07:43 |
|||
* @Entity cn.iocoder.yudao.module.alert.dao.domain.UnitCfg |
|||
*/ |
|||
public interface UnitCfgMapper extends BaseMapper<UnitCfg> { |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,13 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.service; |
|||
|
|||
import cn.iocoder.yudao.module.alert.dao.domain.ModelCfg; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【model_cfg】的数据库操作Service |
|||
* @createDate 2025-05-22 15:45:38 |
|||
*/ |
|||
public interface ModelCfgService extends IService<ModelCfg> { |
|||
|
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.service; |
|||
|
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemCfg; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【system_cfg】的数据库操作Service |
|||
* @createDate 2025-05-21 16:10:38 |
|||
*/ |
|||
public interface SystemCfgService extends IService<SystemCfg> { |
|||
|
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.service; |
|||
|
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemTypeCfg; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【system_type_cfg】的数据库操作Service |
|||
* @createDate 2025-05-21 16:10:57 |
|||
*/ |
|||
public interface SystemTypeCfgService extends IService<SystemTypeCfg> { |
|||
|
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.service; |
|||
|
|||
import cn.iocoder.yudao.module.alert.dao.domain.UnitCfg; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【unit_cfg】的数据库操作Service |
|||
* @createDate 2025-05-21 16:07:43 |
|||
*/ |
|||
public interface UnitCfgService extends IService<UnitCfg> { |
|||
|
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.ModelCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.service.ModelCfgService; |
|||
import cn.iocoder.yudao.module.alert.dao.mapper.ModelCfgMapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【model_cfg】的数据库操作Service实现 |
|||
* @createDate 2025-05-22 15:45:38 |
|||
*/ |
|||
@Service |
|||
public class ModelCfgServiceImpl extends ServiceImpl<ModelCfgMapper, ModelCfg> |
|||
implements ModelCfgService{ |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,22 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.service.SystemCfgService; |
|||
import cn.iocoder.yudao.module.alert.dao.mapper.SystemCfgMapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【system_cfg】的数据库操作Service实现 |
|||
* @createDate 2025-05-21 16:10:38 |
|||
*/ |
|||
@Service |
|||
public class SystemCfgServiceImpl extends ServiceImpl<SystemCfgMapper, SystemCfg> |
|||
implements SystemCfgService{ |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,22 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemTypeCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.service.SystemTypeCfgService; |
|||
import cn.iocoder.yudao.module.alert.dao.mapper.SystemTypeCfgMapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【system_type_cfg】的数据库操作Service实现 |
|||
* @createDate 2025-05-21 16:10:57 |
|||
*/ |
|||
@Service |
|||
public class SystemTypeCfgServiceImpl extends ServiceImpl<SystemTypeCfgMapper, SystemTypeCfg> |
|||
implements SystemTypeCfgService{ |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,22 @@ |
|||
package cn.iocoder.yudao.module.alert.dao.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.UnitCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.service.UnitCfgService; |
|||
import cn.iocoder.yudao.module.alert.dao.mapper.UnitCfgMapper; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @author 陈小黑 |
|||
* @description 针对表【unit_cfg】的数据库操作Service实现 |
|||
* @createDate 2025-05-21 16:07:43 |
|||
*/ |
|||
@Service |
|||
public class UnitCfgServiceImpl extends ServiceImpl<UnitCfgMapper, UnitCfg> |
|||
implements UnitCfgService{ |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,26 @@ |
|||
package cn.iocoder.yudao.module.alert.service.model; |
|||
|
|||
|
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelDataVO; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-09-05 22:10 |
|||
*/ |
|||
public interface ModelDataService { |
|||
/** |
|||
* 获取模型数据 |
|||
* |
|||
* @param modelId 模型id |
|||
* @param type 类型 |
|||
* @param indexList 边界参数索引 |
|||
* @param st 开始时间 |
|||
* @param et 结束时间 |
|||
* @return 模型数据 |
|||
*/ |
|||
ModelDataVO getModelData(Integer modelId, String type, List<Integer> indexList, Date st, Date et); |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
package cn.iocoder.yudao.module.alert.service.model; |
|||
|
|||
|
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.CreateModelInfo; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelInfoVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelSelectQuery; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelSimpleVO; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 13:22 |
|||
*/ |
|||
public interface ModelService { |
|||
/** |
|||
* 获取模型列表 |
|||
* |
|||
* @param query 请求参数 |
|||
* @return model 列表 |
|||
*/ |
|||
List<ModelSimpleVO> getModelList(ModelSelectQuery query); |
|||
|
|||
/** |
|||
* 获取模型信息 |
|||
* |
|||
* @param id 模型id |
|||
* @return 模型信息 |
|||
*/ |
|||
ModelInfoVO getModelInfo(Integer id); |
|||
|
|||
/** |
|||
* 新建模型 |
|||
* |
|||
* @param model 模型参数 |
|||
* @return 模型id |
|||
*/ |
|||
Integer createModel(ModelInfoVO model); |
|||
|
|||
/** |
|||
* 更新model info |
|||
* |
|||
* @param info 模型info |
|||
* @return 是否成功 |
|||
*/ |
|||
Boolean updateModelInfo(ModelInfoVO info); |
|||
} |
|||
@ -0,0 +1,29 @@ |
|||
package cn.iocoder.yudao.module.alert.service.model.impl; |
|||
|
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelDataVO; |
|||
import cn.iocoder.yudao.module.alert.service.model.ModelDataService; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-09-05 22:11 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class ModelDataServiceImpl implements ModelDataService { |
|||
|
|||
|
|||
@Override |
|||
public ModelDataVO getModelData(Integer modelId, String type, List<Integer> indexList, Date st, Date et) { |
|||
|
|||
|
|||
return null; |
|||
} |
|||
} |
|||
@ -0,0 +1,125 @@ |
|||
package cn.iocoder.yudao.module.alert.service.model.impl; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import cn.hutool.core.collection.CollUtil; |
|||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
|||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; |
|||
import cn.iocoder.yudao.module.alert.common.enums.Algorithm; |
|||
import cn.iocoder.yudao.module.alert.common.enums.ModelStatus; |
|||
import cn.iocoder.yudao.module.alert.common.enums.ModelTrash; |
|||
import cn.iocoder.yudao.module.alert.common.enums.ModelVisible; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.model.ModelInfo; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelInfoVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelSelectQuery; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.model.vo.ModelSimpleVO; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.ModelCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.service.ModelCfgService; |
|||
import cn.iocoder.yudao.module.alert.dao.service.SystemCfgService; |
|||
import cn.iocoder.yudao.module.alert.service.model.ModelService; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.Objects; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-19 13:22 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class ModelServiceImpl implements ModelService { |
|||
private final ModelCfgService modelCfgService; |
|||
|
|||
private final SystemCfgService systemCfgService; |
|||
|
|||
@Override |
|||
public List<ModelSimpleVO> getModelList(ModelSelectQuery query) { |
|||
Integer systemId = query.getSystemId(); |
|||
String modelName = query.getName(); |
|||
Integer status = query.getStatus(); |
|||
Integer trash = query.getTrash(); |
|||
Integer typeId = query.getTypeId(); |
|||
List<Integer> systems = null; |
|||
if (Objects.nonNull(typeId)) { |
|||
LambdaQueryWrapper<SystemCfg> systemQuery = new LambdaQueryWrapper<>(); |
|||
systemQuery.eq(SystemCfg::getSystemTypeId, typeId); |
|||
List<SystemCfg> list = systemCfgService.list(systemQuery); |
|||
systems = list.stream().map(SystemCfg::getSystemId).collect(Collectors.toList()); |
|||
} |
|||
LambdaQueryWrapper<ModelCfg> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(Objects.nonNull(systemId), ModelCfg::getSystemId, systemId) |
|||
.eq(Objects.nonNull(status), ModelCfg::getStatus, status) |
|||
.eq(Objects.nonNull(trash), ModelCfg::getTrash, trash) |
|||
.eq(ModelCfg::getVisible, ModelVisible.VISIBLE.code) |
|||
.in(CollUtil.isNotEmpty(systems), ModelCfg::getSystemId, systems) |
|||
.like(StringUtils.hasLength(modelName), ModelCfg::getModelName, modelName); |
|||
List<ModelCfg> list = modelCfgService.list(queryWrapper); |
|||
return list.stream().map(modelCfg -> ModelSimpleVO.builder() |
|||
.id(modelCfg.getId()) |
|||
.name(modelCfg.getModelName().trim()) |
|||
.creator(modelCfg.getCreator()) |
|||
.createTime(modelCfg.getCreateTime()) |
|||
.status(modelCfg.getStatus()) |
|||
.algorithm(Algorithm.of(modelCfg.getAlgorithmId()).toString()) |
|||
.build()) |
|||
.collect(Collectors.toList()); |
|||
} |
|||
|
|||
@Override |
|||
public ModelInfoVO getModelInfo(Integer id) { |
|||
ModelCfg modelCfg = modelCfgService.getById(id); |
|||
if (Objects.nonNull(modelCfg)) { |
|||
return JsonUtils.parseObject(modelCfg.getModelInfo(), ModelInfoVO.class); |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public Integer createModel(ModelInfoVO model) { |
|||
try { |
|||
ModelInfo info = new ModelInfo(); |
|||
BeanUtil.copyProperties(model, info); |
|||
ModelCfg modelCfg = ModelCfg.builder() |
|||
.systemId(model.getSystemId()) |
|||
.algorithmId(model.getAlgorithmId()) |
|||
.modelName(model.getModelName()) |
|||
.createTime(new Date()) |
|||
.trash(ModelTrash.NORMAL.code) |
|||
.visible(ModelVisible.VISIBLE.code) |
|||
.status(ModelStatus.TRAINING.code) |
|||
.creator(SecurityFrameworkUtils.getLoginUserNickname()) |
|||
.build(); |
|||
modelCfgService.save(modelCfg); |
|||
Integer modelId = modelCfg.getId(); |
|||
info.setId(modelId); |
|||
info.setCreator(modelCfg.getCreator()); |
|||
info.setCreateTime(modelCfg.getCreateTime()); |
|||
modelCfg.setModelInfo(JsonUtils.toJsonString(info)); |
|||
modelCfgService.updateById(modelCfg); |
|||
return modelId; |
|||
} catch (Exception e) { |
|||
log.error("新建模型异常,model:{}", model); |
|||
} |
|||
|
|||
return -1; |
|||
} |
|||
|
|||
@Override |
|||
public Boolean updateModelInfo(ModelInfoVO modelInfo) { |
|||
ModelCfg modelCfg = ModelCfg.builder() |
|||
.id(modelInfo.getId()) |
|||
.modelInfo(JsonUtils.toJsonString(modelInfo)) |
|||
.updateTime(new Date()) |
|||
.build(); |
|||
return modelCfgService.updateById(modelCfg); |
|||
} |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package cn.iocoder.yudao.module.alert.service.system; |
|||
|
|||
|
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.OptionItemVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.SelectAllOptionVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.SelectQuery; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-16 22:44 |
|||
*/ |
|||
public interface SelectService { |
|||
/** |
|||
* 获取所有的下拉框选项 |
|||
* |
|||
* @return 下拉框选项 |
|||
*/ |
|||
SelectAllOptionVO getAllOptions(); |
|||
|
|||
/** |
|||
* 根据unit id和type id获取系统选项 |
|||
* |
|||
* @param query 查询参数 |
|||
* @return 系统选项 |
|||
*/ |
|||
List<OptionItemVO> getSystemOptions(SelectQuery query); |
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
package cn.iocoder.yudao.module.alert.service.system.impl; |
|||
|
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.OptionItemVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.SelectAllOptionVO; |
|||
import cn.iocoder.yudao.module.alert.controller.admin.system.vo.SelectQuery; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.SystemTypeCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.domain.UnitCfg; |
|||
import cn.iocoder.yudao.module.alert.dao.service.SystemCfgService; |
|||
import cn.iocoder.yudao.module.alert.dao.service.SystemTypeCfgService; |
|||
import cn.iocoder.yudao.module.alert.dao.service.UnitCfgService; |
|||
import cn.iocoder.yudao.module.alert.service.system.SelectService; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import jakarta.validation.Valid; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @author chenjiale |
|||
* @version 1.0 |
|||
* @date 2023-08-16 22:45 |
|||
*/ |
|||
@Service |
|||
@RequiredArgsConstructor |
|||
public class SelectServiceImpl implements SelectService { |
|||
private final UnitCfgService unitCfgService; |
|||
|
|||
private final SystemTypeCfgService systemTypeCfgService; |
|||
|
|||
private final SystemCfgService systemCfgService; |
|||
|
|||
@Override |
|||
public SelectAllOptionVO getAllOptions() { |
|||
List<UnitCfg> unitCfgList = unitCfgService.list(); |
|||
|
|||
LambdaQueryWrapper<SystemTypeCfg> typeQuery = new LambdaQueryWrapper<>(); |
|||
typeQuery.orderByAsc(SystemTypeCfg::getSystemTypeId); |
|||
List<SystemTypeCfg> typeCfgList = systemTypeCfgService.list(typeQuery); |
|||
|
|||
LambdaQueryWrapper<SystemCfg> queryWrapper = new LambdaQueryWrapper<>(); |
|||
queryWrapper.eq(SystemCfg::getSystemTypeId, typeCfgList.get(0).getSystemTypeId()) |
|||
.eq(SystemCfg::getUnitId, unitCfgList.get(0).getUnitId()) |
|||
.orderByAsc(SystemCfg::getSystemId); |
|||
List<SystemCfg> systemCfgList = systemCfgService.list(queryWrapper); |
|||
|
|||
|
|||
List<OptionItemVO> units = unitCfgList.stream().map(o -> OptionItemVO.builder() |
|||
.id(o.getUnitId()) |
|||
.name(o.getUnitName().trim()) |
|||
.build()).collect(Collectors.toList()); |
|||
List<OptionItemVO> types = typeCfgList.stream().map(o -> OptionItemVO.builder() |
|||
.id(o.getSystemTypeId()) |
|||
.name(o.getSystemTypeShortname().trim()) |
|||
.build()).collect(Collectors.toList()); |
|||
|
|||
List<OptionItemVO> systems = systemCfgList.stream().map(o -> OptionItemVO.builder() |
|||
.id(o.getSystemId()) |
|||
.name(o.getSystemName().trim()) |
|||
.build()).collect(Collectors.toList()); |
|||
systems.add(0, OptionItemVO.builder().id(null).name("全部").build()); |
|||
return SelectAllOptionVO.builder() |
|||
.units(units) |
|||
.types(types) |
|||
.systems(systems) |
|||
.build(); |
|||
} |
|||
|
|||
@Override |
|||
public List<OptionItemVO> getSystemOptions(@Valid SelectQuery query) { |
|||
LambdaQueryWrapper<SystemCfg> queryWrapper = new LambdaQueryWrapper<>(); |
|||
Integer unitId = query.getUnitId(); |
|||
Integer typeId = query.getTypeId(); |
|||
queryWrapper.eq(SystemCfg::getSystemTypeId, typeId) |
|||
.eq(SystemCfg::getUnitId, unitId) |
|||
.orderByAsc(SystemCfg::getSystemId); |
|||
List<SystemCfg> systemCfgList = systemCfgService.list(queryWrapper); |
|||
List<OptionItemVO> systems = systemCfgList.stream().map(o -> OptionItemVO.builder() |
|||
.id(o.getSystemId()) |
|||
.name(o.getSystemName().trim()) |
|||
.build()) |
|||
.collect(Collectors.toList()); |
|||
systems.add(0, OptionItemVO.builder().id(null).name("全部").build()); |
|||
return systems; |
|||
} |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
<?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="cn.iocoder.yudao.module.alert.dao.mapper.ModelCfgMapper"> |
|||
|
|||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.alert.dao.domain.ModelCfg"> |
|||
<id property="id" column="id" jdbcType="INTEGER"/> |
|||
<result property="systemId" column="system_id" jdbcType="INTEGER"/> |
|||
<result property="algorithmId" column="algorithm_id" jdbcType="INTEGER"/> |
|||
<result property="modelName" column="model_name" jdbcType="VARCHAR"/> |
|||
<result property="creatTime" column="creat_time" jdbcType="TIMESTAMP"/> |
|||
<result property="creatName" column="creat_name" jdbcType="VARCHAR"/> |
|||
<result property="modelInfo" column="model_info" jdbcType="VARCHAR"/> |
|||
<result property="status" column="status" jdbcType="INTEGER"/> |
|||
<result property="visible" column="visible" jdbcType="INTEGER"/> |
|||
<result property="conditionInfo" column="condition_info" jdbcType="VARCHAR"/> |
|||
<result property="trash" column="trash" jdbcType="INTEGER"/> |
|||
<result property="assessRes" column="assess_res" jdbcType="VARCHAR"/> |
|||
<result property="needToAssess" column="need_to_assess" jdbcType="INTEGER"/> |
|||
<result property="score" column="score" jdbcType="FLOAT"/> |
|||
<result property="clearOrNot" column="clear_or_not" jdbcType="CHAR"/> |
|||
<result property="effNumber" column="eff_number" jdbcType="INTEGER"/> |
|||
<result property="needToClean" column="need_to_clean" jdbcType="INTEGER"/> |
|||
<result property="origAssessRes" column="orig_assess_res" jdbcType="VARCHAR"/> |
|||
<result property="loadCover" column="load_cover" jdbcType="FLOAT"/> |
|||
<result property="coverOutput" column="cover_output" jdbcType="VARCHAR"/> |
|||
<result property="curVersion" column="cur_version" jdbcType="VARCHAR"/> |
|||
<result property="modelVersion" column="model_version" jdbcType="VARCHAR"/> |
|||
<result property="versionInfo" column="version_info" jdbcType="VARCHAR"/> |
|||
<result property="conditionName" column="condition_name" jdbcType="VARCHAR"/> |
|||
<result property="isOnline" column="is_online" jdbcType="INTEGER"/> |
|||
<result property="trainStatus" column="train_status" jdbcType="INTEGER"/> |
|||
<result property="creator" column="creator" jdbcType="VARCHAR"/> |
|||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
|||
<result property="updater" column="updater" jdbcType="VARCHAR"/> |
|||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> |
|||
<result property="deleted" column="deleted" jdbcType="BIT"/> |
|||
</resultMap> |
|||
|
|||
<sql id="Base_Column_List"> |
|||
id,system_id,algorithm_id, |
|||
model_name,creat_time,creat_name, |
|||
model_info,status,visible, |
|||
condition_info,trash,assess_res, |
|||
need_to_assess,score,clear_or_not, |
|||
eff_number,need_to_clean,orig_assess_res, |
|||
load_cover,cover_output,cur_version, |
|||
model_version,version_info,condition_name, |
|||
is_online,train_status,creator, |
|||
create_time,updater,update_time, |
|||
deleted |
|||
</sql> |
|||
</mapper> |
|||
@ -0,0 +1,23 @@ |
|||
<?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="cn.iocoder.yudao.module.alert.dao.mapper.SystemCfgMapper"> |
|||
|
|||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.alert.dao.domain.SystemCfg"> |
|||
<result property="systemId" column="system_id" jdbcType="INTEGER"/> |
|||
<result property="systemTypeId" column="system_type_id" jdbcType="INTEGER"/> |
|||
<result property="systemName" column="system_name" jdbcType="VARCHAR"/> |
|||
<result property="systemShortname" column="system_shortname" jdbcType="CHAR"/> |
|||
<result property="unitId" column="unit_id" jdbcType="INTEGER"/> |
|||
<result property="resetpoint" column="resetpoint" jdbcType="VARCHAR"/> |
|||
<result property="resettime" column="resettime" jdbcType="TIMESTAMP"/> |
|||
<result property="resetlist" column="resetlist" jdbcType="VARCHAR"/> |
|||
</resultMap> |
|||
|
|||
<sql id="Base_Column_List"> |
|||
system_id,system_type_id,system_name, |
|||
system_shortname,unit_id,resetpoint, |
|||
resettime,resetlist |
|||
</sql> |
|||
</mapper> |
|||
@ -0,0 +1,16 @@ |
|||
<?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="cn.iocoder.yudao.module.alert.dao.mapper.SystemTypeCfgMapper"> |
|||
|
|||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.alert.dao.domain.SystemTypeCfg"> |
|||
<id property="systemTypeId" column="system_type_id" jdbcType="INTEGER"/> |
|||
<result property="systemTypeName" column="system_type_name" jdbcType="CHAR"/> |
|||
<result property="systemTypeShortname" column="system_type_shortname" jdbcType="CHAR"/> |
|||
</resultMap> |
|||
|
|||
<sql id="Base_Column_List"> |
|||
system_type_id,system_type_name,system_type_shortname |
|||
</sql> |
|||
</mapper> |
|||
@ -0,0 +1,28 @@ |
|||
<?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="cn.iocoder.yudao.module.alert.dao.mapper.UnitCfgMapper"> |
|||
|
|||
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.alert.dao.domain.UnitCfg"> |
|||
<result property="unitId" column="unit_id" jdbcType="INTEGER"/> |
|||
<result property="plantId" column="plant_id" jdbcType="INTEGER"/> |
|||
<result property="unitName" column="unit_name" jdbcType="CHAR"/> |
|||
<result property="unitShortname" column="unit_shortname" jdbcType="CHAR"/> |
|||
<result property="alertBasicSample" column="alert_basic_sample" jdbcType="VARCHAR"/> |
|||
<result property="loadpoint" column="loadpoint" jdbcType="VARCHAR"/> |
|||
<result property="temppoint" column="temppoint" jdbcType="VARCHAR"/> |
|||
<result property="capacity" column="capacity" jdbcType="INTEGER"/> |
|||
<result property="zqylqx" column="zqylqx" jdbcType="VARCHAR"/> |
|||
<result property="zqylMeasured" column="zqyl_measured" jdbcType="VARCHAR"/> |
|||
<result property="zqylTarget" column="zqyl_target" jdbcType="VARCHAR"/> |
|||
<result property="datas" column="datas" jdbcType="VARCHAR"/> |
|||
</resultMap> |
|||
|
|||
<sql id="Base_Column_List"> |
|||
unit_id,plant_id,unit_name, |
|||
unit_shortname,alert_basic_sample,loadpoint, |
|||
temppoint,capacity,zqylqx, |
|||
zqyl_measured,zqyl_target,datas |
|||
</sql> |
|||
</mapper> |
|||
Loading…
Reference in new issue