This commit is contained in:
caozehui
2025-03-08 16:49:54 +08:00
parent efccaae69e
commit 189ffad11d
5 changed files with 47 additions and 19 deletions

View File

@@ -1,6 +1,7 @@
package com.njcn.gather.detection.pojo.param; package com.njcn.gather.detection.pojo.param;
import com.njcn.gather.source.pojo.constant.PqSourceValidMessage; import com.njcn.gather.source.pojo.constant.PqSourceValidMessage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
@@ -36,5 +37,8 @@ public class SimulateDetectionParam {
@NotBlank(message = PqSourceValidMessage.ID_NOT_BLANK) @NotBlank(message = PqSourceValidMessage.ID_NOT_BLANK)
private String sourceId; private String sourceId;
/**
* 脚本值类型 1绝对值脚本、2相对值脚本
*/
private int valueType;
} }

View File

@@ -246,21 +246,25 @@ public class PreDetectionServiceImpl implements PreDetectionService {
@Override @Override
public void sendScript(SimulateDetectionParam param) { public void sendScript(SimulateDetectionParam param) {
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + source); Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + source);
if (Objects.isNull(channel) || !channel.isActive()) { // if (Objects.isNull(channel) || !channel.isActive()) {
// 进行源通信连接 // // 进行源通信连接
PreDetectionParam preDetectionParam = new PreDetectionParam(); // PreDetectionParam preDetectionParam = new PreDetectionParam();
preDetectionParam.setSourceId(param.getSourceId()); // preDetectionParam.setSourceId(param.getSourceId());
preDetectionParam.setUserPageId(param.getUserPageId()); // preDetectionParam.setUserPageId(param.getUserPageId());
preDetectionParam.setSendWebMsg(false); // preDetectionParam.setSendWebMsg(false);
this.sendYtxSocketSimulate(preDetectionParam); // this.sendYtxSocketSimulate(preDetectionParam);
} // }
//组装源控制脚本 //组装源控制脚本
PqScriptIssueParam issueParam = new PqScriptIssueParam(); PqScriptIssueParam issueParam = new PqScriptIssueParam();
//issueParam.setPlanId(param.getPlanId()); //issueParam.setPlanId(param.getPlanId());
issueParam.setSourceId(param.getSourceId()); issueParam.setSourceId(param.getSourceId());
//issueParam.setDevIds(param.getDevIds()); //issueParam.setDevIds(param.getDevIds());
issueParam.setScriptId(param.getScriptId()); issueParam.setScriptId(param.getScriptId());
issueParam.setType(1);
issueParam.setValueType(param.getValueType()); // 设置脚本类型
issueParam.setIsPhaseSequence(SourceOperateCodeEnum.SIMULATE_TEST.getValue()); issueParam.setIsPhaseSequence(SourceOperateCodeEnum.SIMULATE_TEST.getValue());
List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam); List<SourceIssue> sourceIssues = pqScriptDtlsService.listSourceIssue(issueParam);
sourceIssues = sourceIssues.stream() sourceIssues = sourceIssues.stream()
.filter(s -> s.getIndex().equals(param.getScriptIndex())) .filter(s -> s.getIndex().equals(param.getScriptIndex()))

View File

@@ -36,4 +36,11 @@ public class PqScriptIssueParam {
@ApiModelProperty("表明指标类型例如Freq频率下的影响、Base额定下的影响、VOL电压下的影响") @ApiModelProperty("表明指标类型例如Freq频率下的影响、Base额定下的影响、VOL电压下的影响")
private String scriptSubType; private String scriptSubType;
@ApiModelProperty("脚本下发类型")
private int type;
@ApiModelProperty("脚本值类型")
private int valueType;
} }

View File

@@ -64,6 +64,7 @@ public interface IPqScriptDtlsService extends IService<PqScriptDtls> {
*/ */
List<SourceIssue> listSourceIssue(PqScriptIssueParam param); List<SourceIssue> listSourceIssue(PqScriptIssueParam param);
/** /**
* 根据脚本类型、脚本id获取index列表 * 根据脚本类型、脚本id获取index列表
* *

View File

@@ -10,9 +10,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.njcn.common.pojo.enums.common.DataStateEnum; import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.gather.detection.pojo.enums.DetectionCodeEnum; 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.pojo.po.PqDev;
import com.njcn.gather.device.service.IPqDevService; 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.PqScriptCheckDataMapper;
import com.njcn.gather.script.mapper.PqScriptDtlsMapper; import com.njcn.gather.script.mapper.PqScriptDtlsMapper;
import com.njcn.gather.script.mapper.PqScriptMapper; 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 com.njcn.gather.type.service.IDevTypeService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.hamcrest.core.Is;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -144,9 +143,17 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
//额定电流信息 //额定电流信息
currSet = devTypes.stream().map(DevType::getDevCurr).collect(Collectors.toSet()); currSet = devTypes.stream().map(DevType::getDevCurr).collect(Collectors.toSet());
} else { } else {
if (ObjectUtil.isNull(param.getType())) {
voltSet.add(1.0); voltSet.add(1.0);
currSet.add(1.0); currSet.add(1.0);
param.setIsPhaseSequence("-1"); param.setIsPhaseSequence("-1");
}else {
if (param.getType() == 1) {
voltSet.add(57.74);
currSet.add(5.0);
param.setIsPhaseSequence("-1");
}
}
} }
@@ -824,8 +831,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
//先获取检测脚本类型是否相对值 true相对值 false绝对值相对值要乘额定值,绝对值不需要处理) //先获取检测脚本类型是否相对值 true相对值 false绝对值相对值要乘额定值,绝对值不需要处理)
queryWrapper.eq(PqScriptDtls::getScriptId, param.getScriptId()); queryWrapper.eq(PqScriptDtls::getScriptId, param.getScriptId());
pqScriptDtls = this.getBaseMapper().selectJoinList(PqScriptDtls.class, queryWrapper); pqScriptDtls = this.getBaseMapper().selectJoinList(PqScriptDtls.class, queryWrapper);
if (CollUtil.isNotEmpty(param.getDevIds())) { if (CollUtil.isNotEmpty(param.getDevIds()) || (ObjectUtil.isNotNull(param.getType())&&param.getType()==1)) {
Boolean isValueType = pqScriptMapper.selectScriptIsValueType(param.getScriptId()); Boolean isValueType;
if (ObjectUtil.isNotNull(param.getValueType()) && param.getValueType() == 2) {
isValueType = true; //相对值脚本
}else {
isValueType = pqScriptMapper.selectScriptIsValueType(param.getScriptId());
}
if (isValueType) { if (isValueType) {
for (PqScriptDtls pqScriptDtl : pqScriptDtls) { for (PqScriptDtls pqScriptDtl : pqScriptDtls) {
if (VOL.equals(pqScriptDtl.getValueType())) { if (VOL.equals(pqScriptDtl.getValueType())) {