Browse Source

fix:预警列表字段调整

pull/33/head
肖晋飞 1 month ago
parent
commit
ba95c0f89e
  1. 16
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/instant/vo/pointInfo.java
  2. 2
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/vo/WarnRespVO.java
  3. 12
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/vo/WarnSaveReqVO.java
  4. 4
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/warnController.java
  5. 6
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/dal/dataobject/report/Report.java
  6. 3
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/dal/dataobject/warn/WarnDO.java
  7. 18
      yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/service/instant/InstantServiceImpl.java

16
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/instant/vo/pointInfo.java

@ -6,19 +6,19 @@ import lombok.Data;
@Data @Data
public class pointInfo { public class pointInfo {
@JsonProperty(value="PointId") @JsonProperty(value="pointId")
@Schema(description = "点号", example = "id") @Schema(description = "点号", example = "id")
private String PointId; private String pointId;
@JsonProperty(value="Description") @JsonProperty(value="description")
@Schema(description = "描述", example = "yudao") @Schema(description = "描述", example = "yudao")
private String Description; private String description;
@JsonProperty(value="Unit") @JsonProperty(value="unit")
@Schema(description = "单位", example = "yudao") @Schema(description = "单位", example = "yudao")
private String Unit; private String unit;
@JsonProperty(value="Type") @JsonProperty(value="type")
@Schema(description = "类型(输入-false;输出-true;ANN-空)", example = "yudao") @Schema(description = "类型(输入-false;输出-true;ANN-空)", example = "yudao")
private Object Type; private Object type;
} }

2
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/vo/WarnRespVO.java

@ -30,6 +30,8 @@ public class WarnRespVO {
private String mpName; private String mpName;
private String equation;
private String outputPoint;
private String unit; private String unit;

12
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/vo/WarnSaveReqVO.java

@ -18,15 +18,15 @@ public class WarnSaveReqVO {
private Long id; private Long id;
@Schema(description = "实例编号", example = "1") @Schema(description = "实例编号", example = "1")
@NotNull(message = "实例编号不能为空") // @NotNull(message = "实例编号不能为空")
private Long mpId; private Long mpId;
@Schema(description = "点号", example = "1") @Schema(description = "点号", example = "1")
@NotNull(message = "点号不能为空") // @NotNull(message = "点号不能为空")
private String pointId; private String pointId;
@Schema(description = "点号", example = "1") @Schema(description = "点号", example = "1")
@NotNull(message = "点号不能为空") // @NotNull(message = "点号不能为空")
private String pointName; private String pointName;
@Schema(description = "光子牌", example = "1") @Schema(description = "光子牌", example = "1")
@ -34,15 +34,15 @@ public class WarnSaveReqVO {
private String gzpName; private String gzpName;
@Schema(description = "报警表达式", example = "1") @Schema(description = "报警表达式", example = "1")
@NotNull(message = "报警表达式不能为空") // @NotNull(message = "报警表达式不能为空")
private String equation; private String equation;
@Schema(description = "输出点号", example = "1") @Schema(description = "输出点号", example = "1")
@NotNull(message = "输出点号不能为空") // @NotNull(message = "输出点号不能为空")
private String outputPoint; private String outputPoint;
@Schema(description = "单位", example = "1") @Schema(description = "单位", example = "1")
@NotNull(message = "单位不能为空") // @NotNull(message = "单位不能为空")
private String unit; private String unit;
@Schema(description = "参与报警", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @Schema(description = "参与报警", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")

4
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/controller/admin/warn/warnController.java

@ -36,7 +36,7 @@ public class warnController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得预警分页列表") @Operation(summary = "获得预警分页列表")
@PreAuthorize("@ss.hasPermission('run:warn:query')") @PreAuthorize("@ss.hasPermission('run:warn:query')")
public CommonResult<PageResult<WarnRespVO>> getInstantPage(@Valid WarnPageReqVO pageReqVO) { public CommonResult<PageResult<WarnRespVO>> getWarnPage(@Valid WarnPageReqVO pageReqVO) {
PageResult<WarnDO> pageResult = warnService.getWarnPage(pageReqVO); PageResult<WarnDO> pageResult = warnService.getWarnPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, WarnRespVO.class)); return success(BeanUtils.toBean(pageResult, WarnRespVO.class));
} }
@ -52,7 +52,7 @@ public class warnController {
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "修改预警") @Operation(summary = "修改预警")
@PreAuthorize("@ss.hasPermission('run:warn:update')") @PreAuthorize("@ss.hasPermission('run:warn:update')")
public CommonResult<Boolean> updateInstant(@Valid @RequestBody WarnSaveReqVO updateReqVO) { public CommonResult<Boolean> updateWarn(@Valid @RequestBody WarnSaveReqVO updateReqVO) {
warnService.updateWarn(updateReqVO); warnService.updateWarn(updateReqVO);
return success(true); return success(true);
} }

6
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/dal/dataobject/report/Report.java

@ -7,12 +7,14 @@ import java.util.List;
@Data @Data
public class Report { public class Report {
public List<point> assess; //相较于windows版本字段有变化
public List<point> assessRows;
@Data @Data
public static class point public static class point
{ {
public String PointId; public String pointId;
public double amplitude; public double amplitude;
public int index; public int index;
} }

3
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/dal/dataobject/warn/WarnDO.java

@ -28,7 +28,8 @@ public class WarnDO extends BaseDO {
private String formula; private String formula;
private String unit; private String unit;
private String equation;
private String outputPoint;
//报警类型-id //报警类型-id
private Long alarmLevel; private Long alarmLevel;
//报警类型 //报警类型

18
yudao-module-alert/yudao-module-alert-biz/src/main/java/cn/iocoder/yudao/module/alert/service/instant/InstantServiceImpl.java

@ -244,7 +244,7 @@ public class InstantServiceImpl implements InstantService {
Report reportObj = JsonUtils.parseObject(report.getReport(), Report.class); Report reportObj = JsonUtils.parseObject(report.getReport(), Report.class);
// 此处可根据业务需求处理解析后的Report对象(如后续预警逻辑) // 此处可根据业务需求处理解析后的Report对象(如后续预警逻辑)
// 循环getInputInfo构建并插入预警记录 // 循环getInputInfo构建并插入预警记录
for (int j = 0; j < reportObj.getAssess().size(); j++) { for (int j = 0; j < reportObj.getAssessRows().size(); j++) {
WarnSaveReqVO warnSaveReqVO = new WarnSaveReqVO(); WarnSaveReqVO warnSaveReqVO = new WarnSaveReqVO();
@ -252,14 +252,14 @@ public class InstantServiceImpl implements InstantService {
// warn.setId(insertId); // warn.setId(insertId);
//设置实例id //设置实例id
warnSaveReqVO.setMpId(instant.getId()); warnSaveReqVO.setMpId(instant.getId());
warnSaveReqVO.setPointId(createReqVO.getInputInfo().get(reportObj.getAssess().get(j).getIndex())); warnSaveReqVO.setPointId(createReqVO.getInputInfo().get(reportObj.getAssessRows().get(j).getIndex()));
warnSaveReqVO.setPointName(createReqVO.getInputName().get(reportObj.getAssess().get(j).getIndex())); warnSaveReqVO.setPointName(createReqVO.getInputName().get(reportObj.getAssessRows().get(j).getIndex()));
warnSaveReqVO.setGzpName(createReqVO.getInputName().get(reportObj.getAssess().get(j).getIndex())); warnSaveReqVO.setGzpName(createReqVO.getInputName().get(reportObj.getAssessRows().get(j).getIndex()));
warnSaveReqVO.setEquation("[" + createReqVO.getBiasPointInfo().get(reportObj.getAssess().get(j).getIndex()) + "]>UPLIMIT or [" + createReqVO.getBiasPointInfo().get(reportObj.getAssess().get(j).getIndex()) + "]<LOWLIMIT"); warnSaveReqVO.setEquation("[" + createReqVO.getBiasPointInfo().get(reportObj.getAssessRows().get(j).getIndex()) + "]>UPLIMIT or [" + createReqVO.getBiasPointInfo().get(reportObj.getAssessRows().get(j).getIndex()) + "]<LOWLIMIT");
warnSaveReqVO.setUplimit(reportObj.getAssess().get(j).getAmplitude()); warnSaveReqVO.setUplimit(reportObj.getAssessRows().get(j).getAmplitude());
warnSaveReqVO.setLowlimit(-reportObj.getAssess().get(j).getAmplitude()); warnSaveReqVO.setLowlimit(-reportObj.getAssessRows().get(j).getAmplitude());
warnSaveReqVO.setOutputPoint(createReqVO.getOutPointInfo().get(reportObj.getAssess().get(j).getIndex())); warnSaveReqVO.setOutputPoint(createReqVO.getOutPointInfo().get(reportObj.getAssessRows().get(j).getIndex()));
warnSaveReqVO.setUnit(createReqVO.getUnit().get(reportObj.getAssess().get(j).getIndex())); warnSaveReqVO.setUnit(createReqVO.getUnit().get(reportObj.getAssessRows().get(j).getIndex()));
// 设置其他必要字段(根据实际业务补充) // 设置其他必要字段(根据实际业务补充)
warnSaveReqVO.setWarnStatus(1L); // 示例:设置初始状态 warnSaveReqVO.setWarnStatus(1L); // 示例:设置初始状态

Loading…
Cancel
Save