1.源参数下发增加装置下发参数
2.调整数据返回信息
This commit is contained in:
@@ -71,8 +71,11 @@ public class PqErrSysParam {
|
||||
@ApiModelProperty("所属误差体系ID")
|
||||
private String errorSysId;
|
||||
|
||||
@ApiModelProperty("检测脚本类型")
|
||||
private List<String> type;
|
||||
@ApiModelProperty("总检测脚本中的测试项序号")
|
||||
private Integer index;
|
||||
|
||||
@ApiModelProperty("所属检测脚本")
|
||||
private String scriptId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.gather.device.err.pojo.param.PqErrSysDtlsParam;
|
||||
import com.njcn.gather.device.err.pojo.param.PqErrSysParam;
|
||||
import com.njcn.gather.device.err.pojo.po.PqErrSysDtls;
|
||||
import com.njcn.gather.device.err.service.IPqErrSysDtlsService;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -27,6 +28,9 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqErrSysDtls> implements IPqErrSysDtlsService {
|
||||
|
||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysId(String pqErrSysId) {
|
||||
return this.lambdaQuery().eq(PqErrSysDtls::getErrorSysId, pqErrSysId).orderBy(true, true,PqErrSysDtls::getSort).list();
|
||||
@@ -65,9 +69,13 @@ public class PqErrSysDtlsServiceImpl extends ServiceImpl<PqErrSysDtlsMapper, PqE
|
||||
|
||||
@Override
|
||||
public List<PqErrSysDtls> listPqErrSysDtlsByPqErrSysIdAndTypes(PqErrSysParam.DetectionParam param) {
|
||||
return this.list(new LambdaQueryWrapper<PqErrSysDtls>()
|
||||
.eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
.in(PqErrSysDtls::getErrorSysId, param.getType())
|
||||
);
|
||||
//根据检测脚本id和检测序号,查询出检测子项目
|
||||
|
||||
|
||||
// return this.list(new LambdaQueryWrapper<PqErrSysDtls>()
|
||||
// .eq(PqErrSysDtls::getErrorSysId, param.getErrorSysId())
|
||||
// .in(PqErrSysDtls::getErrorSysId, param.getType())
|
||||
// );
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.gather.device.script.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/27 9:29
|
||||
*/
|
||||
public interface PqScriptCheckDataMapper extends MPJBaseMapper<PqScriptCheckData> {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?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="com.njcn.gather.device.script.mapper.PqScriptCheckDataMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.gather.device.script.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class PqScriptCheckDataParam {
|
||||
|
||||
|
||||
@ApiModelProperty("检测脚本ID")
|
||||
private String scriptId;
|
||||
|
||||
@ApiModelProperty("总检测脚本中的测试项序号")
|
||||
private Integer index;
|
||||
|
||||
@ApiModelProperty("检测指标类型(true:展示名称 ,false展示id ,默认false)")
|
||||
private Boolean isValueTypeName=false;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.njcn.gather.device.script.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName(value = "pq_script_checkdata")
|
||||
public class PqScriptCheckData implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 检测脚本参考设定值ID
|
||||
*/
|
||||
@TableId
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 检测脚本ID
|
||||
*/
|
||||
private String scriptId;
|
||||
|
||||
/**
|
||||
* 总检测脚本中的测试项序号
|
||||
*/
|
||||
private Integer index;
|
||||
|
||||
/**
|
||||
* 检测指标类型,与数据字典关联(例如电压有效值、谐波电压含有率等)
|
||||
*/
|
||||
private String valueType;
|
||||
|
||||
/**
|
||||
* 数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 相别,字典表
|
||||
*/
|
||||
private String phase;
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private Double value;
|
||||
|
||||
/**
|
||||
* (间)谐波次数
|
||||
*/
|
||||
@TableField("HarmNum")
|
||||
private Double harmNum;
|
||||
|
||||
/**
|
||||
* 状态:0-不启用 1-启用
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -24,6 +24,9 @@ public class SourceIssue {
|
||||
@JSONField(serialize = false)
|
||||
private Integer index;
|
||||
|
||||
@JSONField(serialize = false)
|
||||
private List<String> devValueTypeList;
|
||||
|
||||
/**
|
||||
* 检测类型
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.gather.device.script.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PqScriptCheckDataVO implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 总检测脚本中的测试项序号
|
||||
*/
|
||||
private String valueTypeId;
|
||||
|
||||
/**
|
||||
* 检测指标类型,与数据字典关联(例如电压有效值、谐波电压含有率等)
|
||||
*/
|
||||
private String valueTypeCode;
|
||||
|
||||
/**
|
||||
* 数据类型,来源于字典表,包括实时数据(3s)、分钟统计数据(1min/3min/5min/10min)等
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.gather.device.script.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/27 9:29
|
||||
*/
|
||||
public interface IPqScriptCheckDataService extends IService<PqScriptCheckData> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取检测指标类型
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<String> getValueType(PqScriptCheckDataParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.gather.device.script.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
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.device.script.mapper.PqScriptCheckDataMapper;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptCheckData;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @Description:
|
||||
* @Author: wr
|
||||
* @Date: 2024/12/27 9:29
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqScriptCheckDataServiceImpl extends ServiceImpl<PqScriptCheckDataMapper, PqScriptCheckData> implements IPqScriptCheckDataService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getValueType(PqScriptCheckDataParam param) {
|
||||
MPJLambdaWrapper<PqScriptCheckData> queryWrapper = new MPJLambdaWrapper<>();
|
||||
queryWrapper.selectAll(PqScriptCheckData.class)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptCheckData::getValueType)
|
||||
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||
.eq(PqScriptCheckData::getIndex, param.getIndex())
|
||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
||||
if (param.getIsValueTypeName()) {
|
||||
queryWrapper.selectAs(DictTree::getCode, PqScriptCheckData::getValueType);
|
||||
}
|
||||
List<PqScriptCheckData> pqScriptCheckData = this.getBaseMapper().selectJoinList(PqScriptCheckData.class, queryWrapper);
|
||||
if(CollUtil.isNotEmpty(pqScriptCheckData)){
|
||||
if (param.getIsValueTypeName()) {
|
||||
return pqScriptCheckData.stream().map(x -> x.getDataType() + "$" + x.getValueType()).collect(Collectors.toList());
|
||||
} else {
|
||||
return pqScriptCheckData.stream().map(PqScriptCheckData::getValueType).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.gather.device.script.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
@@ -10,10 +11,12 @@ import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.device.service.IPqDevService;
|
||||
import com.njcn.gather.device.script.mapper.PqScriptDtlsMapper;
|
||||
import com.njcn.gather.device.script.mapper.PqScriptMapper;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptCheckDataParam;
|
||||
import com.njcn.gather.device.script.pojo.param.PqScriptIssueParam;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScript;
|
||||
import com.njcn.gather.device.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.device.script.pojo.po.SourceIssue;
|
||||
import com.njcn.gather.device.script.service.IPqScriptCheckDataService;
|
||||
import com.njcn.gather.device.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -61,6 +64,7 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
|
||||
private final IPqDevService pqDevService;
|
||||
private final PqScriptMapper pqScriptMapper;
|
||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@@ -141,7 +145,13 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
issue.setSourceId(param.getSourceId());
|
||||
issue.setType(freqDtls.getScriptType());
|
||||
issue.setIndex(freqDtls.getIndex());
|
||||
issue.setSubType(freqDtls.getScriptSubType().replace("Base", "NULL"));
|
||||
String scriptSubType = freqDtls.getScriptSubType();
|
||||
issue.setSubType(StrUtil.isBlank(scriptSubType)?scriptSubType:scriptSubType.replace("Base", "NULL"));
|
||||
PqScriptCheckDataParam checkDataParam = new PqScriptCheckDataParam();
|
||||
checkDataParam.setScriptId(freqDtls.getScriptId());
|
||||
checkDataParam.setIndex(freqDtls.getIndex());
|
||||
checkDataParam.setIsValueTypeName(true);
|
||||
issue.setDevValueTypeList(pqScriptCheckDataService.getValueType(checkDataParam));
|
||||
issue.setFUn(volt);
|
||||
issue.setFIn(curr);
|
||||
issue.setFFreq(freqDtls.getValue());
|
||||
@@ -204,10 +214,10 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
if (isValueType) {
|
||||
for (PqScriptDtls pqScriptDtl : pqScriptDtls) {
|
||||
if (VOL.equals(pqScriptDtl.getValueType())) {
|
||||
pqScriptDtl.setValue(pqScriptDtl.getChagValue() * volt);
|
||||
pqScriptDtl.setValue(pqScriptDtl.getValue() * volt);
|
||||
}
|
||||
if (CUR.equals(pqScriptDtl.getValueType())) {
|
||||
pqScriptDtl.setValue(pqScriptDtl.getChagValue() * curr);
|
||||
pqScriptDtl.setValue(pqScriptDtl.getValue() * curr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
device/src/main/resources/mapper/PqScriptCheckdataMapper.xml
Normal file
24
device/src/main/resources/mapper/PqScriptCheckdataMapper.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?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="generator.mapper.PqScriptCheckdataMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.njcn.gather.device.script.pojo.po.PqScriptCheckData">
|
||||
<id property="id" column="Id" jdbcType="CHAR"/>
|
||||
<result property="scriptId" column="Script_Id" jdbcType="CHAR"/>
|
||||
<result property="index" column="Index" jdbcType="INTEGER"/>
|
||||
<result property="valueType" column="Value_Type" jdbcType="CHAR"/>
|
||||
<result property="dataType" column="Data_Type" jdbcType="CHAR"/>
|
||||
<result property="phase" column="Phase" jdbcType="CHAR"/>
|
||||
<result property="value" column="Value" jdbcType="FLOAT"/>
|
||||
<result property="harmnum" column="HarmNum" jdbcType="FLOAT"/>
|
||||
<result property="enable" column="Enable" jdbcType="TINYINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
Id,Script_Id,Index,
|
||||
Value_Type,Data_Type,Phase,
|
||||
Value,HarmNum,Enable
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user