diff --git a/detection/src/main/java/com/njcn/gather/detection/pojo/param/SimulateDetectionParam.java b/detection/src/main/java/com/njcn/gather/detection/pojo/param/SimulateDetectionParam.java index f60aec7c..4e4b43d5 100644 --- a/detection/src/main/java/com/njcn/gather/detection/pojo/param/SimulateDetectionParam.java +++ b/detection/src/main/java/com/njcn/gather/detection/pojo/param/SimulateDetectionParam.java @@ -1,6 +1,7 @@ package com.njcn.gather.detection.pojo.param; import com.njcn.gather.source.pojo.constant.PqSourceValidMessage; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -36,5 +37,8 @@ public class SimulateDetectionParam { @NotBlank(message = PqSourceValidMessage.ID_NOT_BLANK) private String sourceId; - + /** + * 脚本值类型 1绝对值脚本、2相对值脚本 + */ + private int valueType; } diff --git a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java index 24aaf0d1..8af457f7 100644 --- a/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/detection/service/impl/PreDetectionServiceImpl.java @@ -246,21 +246,25 @@ public class PreDetectionServiceImpl implements PreDetectionService { @Override public void sendScript(SimulateDetectionParam param) { Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + source); - if (Objects.isNull(channel) || !channel.isActive()) { - // 进行源通信连接 - PreDetectionParam preDetectionParam = new PreDetectionParam(); - preDetectionParam.setSourceId(param.getSourceId()); - preDetectionParam.setUserPageId(param.getUserPageId()); - preDetectionParam.setSendWebMsg(false); - this.sendYtxSocketSimulate(preDetectionParam); - } +// if (Objects.isNull(channel) || !channel.isActive()) { +// // 进行源通信连接 +// PreDetectionParam preDetectionParam = new PreDetectionParam(); +// preDetectionParam.setSourceId(param.getSourceId()); +// preDetectionParam.setUserPageId(param.getUserPageId()); +// preDetectionParam.setSendWebMsg(false); +// this.sendYtxSocketSimulate(preDetectionParam); +// } //组装源控制脚本 PqScriptIssueParam issueParam = new PqScriptIssueParam(); //issueParam.setPlanId(param.getPlanId()); issueParam.setSourceId(param.getSourceId()); //issueParam.setDevIds(param.getDevIds()); issueParam.setScriptId(param.getScriptId()); + issueParam.setType(1); + issueParam.setValueType(param.getValueType()); // 设置脚本类型 issueParam.setIsPhaseSequence(SourceOperateCodeEnum.SIMULATE_TEST.getValue()); + + List sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam); sourceIssues = sourceIssues.stream() .filter(s -> s.getIndex().equals(param.getScriptIndex())) diff --git a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java index d87b0015..840d48a4 100644 --- a/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java +++ b/detection/src/main/java/com/njcn/gather/script/pojo/param/PqScriptIssueParam.java @@ -36,4 +36,11 @@ public class PqScriptIssueParam { @ApiModelProperty("表明指标类型(例如:Freq频率下的影响、Base额定下的影响、VOL电压下的影响)") private String scriptSubType; + + @ApiModelProperty("脚本下发类型") + private int type; + + @ApiModelProperty("脚本值类型") + private int valueType; + } diff --git a/detection/src/main/java/com/njcn/gather/script/service/IPqScriptDtlsService.java b/detection/src/main/java/com/njcn/gather/script/service/IPqScriptDtlsService.java index 71cbded9..b2483f4a 100644 --- a/detection/src/main/java/com/njcn/gather/script/service/IPqScriptDtlsService.java +++ b/detection/src/main/java/com/njcn/gather/script/service/IPqScriptDtlsService.java @@ -64,6 +64,7 @@ public interface IPqScriptDtlsService extends IService { */ List listSourceIssue(PqScriptIssueParam param); + /** * 根据脚本类型、脚本id获取index列表 * 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 9aa5d778..8d3f3f3d 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 @@ -10,9 +10,9 @@ 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.gather.detection.pojo.enums.DetectionCodeEnum; +import com.njcn.gather.device.pojo.enums.CommonEnum; import com.njcn.gather.device.pojo.po.PqDev; import com.njcn.gather.device.service.IPqDevService; -import com.njcn.gather.device.pojo.enums.CommonEnum; import com.njcn.gather.script.mapper.PqScriptCheckDataMapper; import com.njcn.gather.script.mapper.PqScriptDtlsMapper; import com.njcn.gather.script.mapper.PqScriptMapper; @@ -34,7 +34,6 @@ import com.njcn.gather.type.pojo.po.DevType; import com.njcn.gather.type.service.IDevTypeService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.hamcrest.core.Is; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -144,9 +143,17 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl curList = value.stream().filter(x -> CUR.equals(x.getValueType())) @@ -219,7 +226,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl