diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionResponseEnum.java b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionResponseEnum.java index bbdeda98..f491afac 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionResponseEnum.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/enums/DetectionResponseEnum.java @@ -9,6 +9,7 @@ import lombok.Getter; @Getter public enum DetectionResponseEnum { PLAN_PATTERN_NOT("A020001", "计划模式查询为空"), + SCRIPT_PATTERN_NOT("A020001", "检测脚本查询为空"), SOURCE_INFO_NOT("A020002", "源表信息不存在"), PLAN_AND_SOURCE_NOT("A020003", "计划和源关系不存在"), ITEM_TEST_NOT("A020004", "检测项为空"), diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java index ad79d9c2..99ee02aa 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptParam.java @@ -53,6 +53,26 @@ public class PqScriptParam { @DateTimeStrValid(format = "yyyy", message = DevValidMessage.STANDARD_TIME_FORMAT_ERROR) private String standardTime; + + /** + * 额定电压 + */ + @ApiModelProperty("额定电压") + @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) + @Min(value = 0, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) + @Max(value = 380, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) + private Double ratedVolt; + + /** + * 额定电流 + */ + @ApiModelProperty("额定电流") + @NotNull(message = DevValidMessage.SCRIPT_TYPE_NOT_BLANK) + @Min(value = 0, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) + @Max(value = 20, message = DevValidMessage.SCRIPT_TYPE_FORMAT_ERROR) + private Double ratedCurr; + + @Data @EqualsAndHashCode(callSuper = true) public static class QueryParam extends BaseParam { diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScript.java b/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScript.java index 24f568d8..9a06053c 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScript.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/po/PqScript.java @@ -63,6 +63,16 @@ public class PqScript extends BaseEntity implements Serializable { @JsonSerialize(using = LocalDateSerializer.class) private LocalDate standardTime; + /** + * 额定电压 + */ + private Double ratedVolt; + + /** + * 额定电流 + */ + private Double ratedCurr; + /** * 状态:0-删除 1-正常 */ diff --git a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java index 793c2723..deea5595 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/script/service/impl/PqScriptDtlsServiceImpl.java @@ -9,7 +9,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.njcn.common.pojo.enums.common.DataStateEnum; +import com.njcn.common.pojo.exception.BusinessException; import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum; +import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum; import com.njcn.gather.device.pojo.enums.CommonEnum; import com.njcn.gather.device.pojo.po.PqDev; import com.njcn.gather.device.service.IPqDevService; @@ -131,17 +133,15 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl list = pqDevService.list(new LambdaQueryWrapper() - .eq(StrUtil.isNotBlank(param.getPlanId()), PqDev::getPlanId, param.getPlanId()) - .in(PqDev::getId, param.getDevIds()) - .eq(PqDev::getState, DataStateEnum.ENABLE.getCode()) - ); - Set devTypeSet = list.stream().map(PqDev::getDevType).collect(Collectors.toSet()); - List devTypes = devTypeService.listByIds(devTypeSet); + PqScript pqScript = pqScriptMapper.selectOne(new LambdaQueryWrapper() + .eq(PqScript::getId, param.getScriptId())); + if(ObjectUtil.isNull(pqScript)){ + throw new BusinessException(DetectionResponseEnum.SCRIPT_PATTERN_NOT); + } //额定电压信息 - voltSet = devTypes.stream().map(DevType::getDevVolt).collect(Collectors.toSet()); + voltSet.add(pqScript.getRatedVolt()); //额定电流信息 - currSet = devTypes.stream().map(DevType::getDevCurr).collect(Collectors.toSet()); + currSet.add(pqScript.getRatedCurr()); } else { if (param.getType() == 0) { voltSet.add(1.0); @@ -154,7 +154,6 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl