1.添加相角启用配置和逻辑处理
2.修正数据处理逻辑以支持相角启用配置
This commit is contained in:
@@ -35,6 +35,7 @@ import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
|||||||
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||||
import com.njcn.gather.system.reg.service.ISysRegResService;
|
import com.njcn.gather.system.reg.service.ISysRegResService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@@ -81,7 +82,8 @@ public class SocketDevResponseService {
|
|||||||
private final ISysTestConfigService sysTestConfigService;
|
private final ISysTestConfigService sysTestConfigService;
|
||||||
private final AdHarmonicService adHarmonicService;
|
private final AdHarmonicService adHarmonicService;
|
||||||
private final IAdPlanService adPlanService;
|
private final IAdPlanService adPlanService;
|
||||||
|
@Value("${phaseAngle.isEnable}")
|
||||||
|
private Boolean isPhaseAngle;
|
||||||
|
|
||||||
// private final ExecutorService executorPool = Executors.newFixedThreadPool(10);
|
// private final ExecutorService executorPool = Executors.newFixedThreadPool(10);
|
||||||
|
|
||||||
@@ -563,12 +565,12 @@ public class SocketDevResponseService {
|
|||||||
coefficientVO.setCIeData(String.valueOf(optionalIC));
|
coefficientVO.setCIeData(String.valueOf(optionalIC));
|
||||||
|
|
||||||
if (XiNumberManager.stepNumber == 0 || XiNumberManager.stepNumber == 1) {
|
if (XiNumberManager.stepNumber == 0 || XiNumberManager.stepNumber == 1) {
|
||||||
Integer aXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUa_gain() / optionalA).setScale(0,RoundingMode.HALF_UP).intValue();
|
Integer aXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUa_gain() / optionalA).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||||
Integer bXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUb_gain() / optionalB).setScale(0,RoundingMode.HALF_UP).intValue();
|
Integer bXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUb_gain() / optionalB).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||||
Integer cXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUc_gain() / optionalC).setScale(0,RoundingMode.HALF_UP).intValue();
|
Integer cXi = BigDecimal.valueOf(devParameter.getDevVolt() * startF.getF().getUc_gain() / optionalC).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||||
Integer aIXi =BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIa_gain() / optionalIA).setScale(0,RoundingMode.HALF_UP).intValue();
|
Integer aIXi = BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIa_gain() / optionalIA).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||||
Integer bIXi =BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIb_gain() / optionalIB).setScale(0,RoundingMode.HALF_UP).intValue();
|
Integer bIXi = BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIb_gain() / optionalIB).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||||
Integer cIXi =BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIc_gain() / optionalIC).setScale(0,RoundingMode.HALF_UP).intValue();
|
Integer cIXi = BigDecimal.valueOf(devParameter.getDevCurr() * startF.getF().getIc_gain() / optionalIC).setScale(0, RoundingMode.HALF_UP).intValue();
|
||||||
|
|
||||||
coefficientVO.setAVuXi(aXi.toString());
|
coefficientVO.setAVuXi(aXi.toString());
|
||||||
coefficientVO.setBVuXi(bXi.toString());
|
coefficientVO.setBVuXi(bXi.toString());
|
||||||
@@ -1285,13 +1287,22 @@ public class SocketDevResponseService {
|
|||||||
List<DevData.SqlDataDTO> data,
|
List<DevData.SqlDataDTO> data,
|
||||||
List<DevData.SqlDataDTO> dataPhase) {
|
List<DevData.SqlDataDTO> dataPhase) {
|
||||||
StringBuffer str = new StringBuffer();
|
StringBuffer str = new StringBuffer();
|
||||||
if (data.size() == dataPhase.size()) {
|
if(isPhaseAngle){
|
||||||
|
if(CollUtil.isNotEmpty(data)&&CollUtil.isNotEmpty(dataPhase)){
|
||||||
|
if (data.size() == dataPhase.size()) {
|
||||||
|
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
||||||
|
DevData.SqlDataDTO.ListDTO phase = dataPhase.get(0).getList();
|
||||||
|
str.append("装置(" + type + "a=" + String.format("%.4f", dto.getA()) + ",相角=" + String.format("%.4f", phase.getA()) + "° " +
|
||||||
|
type + "b=" + String.format("%.4f", dto.getB()) + ",相角=" + String.format("%.4f", phase.getB()) + "° " +
|
||||||
|
type + "c=" + String.format("%.4f", dto.getC()) + ",相角=" + String.format("%.4f", phase.getC()) + "° ");
|
||||||
|
str.append(")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
||||||
DevData.SqlDataDTO.ListDTO phase = dataPhase.get(0).getList();
|
str.append("装置(" + type + "a=" + String.format("%.4f", dto.getA()) +
|
||||||
|
type + "b=" + String.format("%.4f", dto.getB()) +
|
||||||
str.append("装置(" + type + "a=" + String.format("%.4f", dto.getA()) + ",相角=" + String.format("%.4f", phase.getA()) + "° " +
|
type + "c=" + String.format("%.4f", dto.getC()) );
|
||||||
type + "b=" + String.format("%.4f", dto.getB()) + ",相角=" + String.format("%.4f", phase.getB()) + "° " +
|
|
||||||
type + "c=" + String.format("%.4f", dto.getC()) + ",相角=" + String.format("%.4f", phase.getC()) + "° ");
|
|
||||||
str.append(")");
|
str.append(")");
|
||||||
}
|
}
|
||||||
return str.toString();
|
return str.toString();
|
||||||
@@ -1366,20 +1377,33 @@ public class SocketDevResponseService {
|
|||||||
//源信息
|
//源信息
|
||||||
Map<String, SourceIssue.ChannelListDTO> sourceMap = channelList.stream()
|
Map<String, SourceIssue.ChannelListDTO> sourceMap = channelList.stream()
|
||||||
.collect(Collectors.toMap(x -> x.getChannelType(), Function.identity()));
|
.collect(Collectors.toMap(x -> x.getChannelType(), Function.identity()));
|
||||||
Boolean a = getaBoolean(sourceMap.get(type + "a"), data.get(0).getList().getA(), dataPhase.get(0).getList().getA());
|
Boolean a = getaBoolean(sourceMap.get(type + "a"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getA() : null,
|
||||||
Boolean b = getaBoolean(sourceMap.get(type + "b"), data.get(0).getList().getB(), dataPhase.get(0).getList().getB());
|
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getA(): null);
|
||||||
Boolean c = getaBoolean(sourceMap.get(type + "c"), data.get(0).getList().getC(), dataPhase.get(0).getList().getC());
|
Boolean b = getaBoolean(sourceMap.get(type + "b"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getB(): null,
|
||||||
|
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getB(): null);
|
||||||
|
Boolean c = getaBoolean(sourceMap.get(type + "c"), CollUtil.isNotEmpty(data) ? data.get(0).getList().getC(): null,
|
||||||
|
CollUtil.isNotEmpty(dataPhase) ? dataPhase.get(0).getList().getC(): null);
|
||||||
compareDev.setIsQualified(a && b && c);
|
compareDev.setIsQualified(a && b && c);
|
||||||
compareDev.setDesc(name + (compareDev.getIsQualified() ? "合格->" : "不合格->") + stepTag + desc + stepTag + devMessage(type, data, dataPhase));
|
compareDev.setDesc(name + (compareDev.getIsQualified() ? "合格->" : "不合格->") + stepTag + desc + stepTag + devMessage(type, data, dataPhase));
|
||||||
return compareDev;
|
return compareDev;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
private Boolean getaBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devData, Double devPhase) {
|
||||||
return NumberUtil.isIn(BigDecimal.valueOf(devData),
|
Boolean isDev = false;
|
||||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
Boolean isPhase = false;
|
||||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 1.05))
|
if(ObjectUtil.isNotNull(devData)){
|
||||||
&&
|
isDev= NumberUtil.isIn(BigDecimal.valueOf(devData),
|
||||||
phaseBoolean(channelListDTO, devPhase);
|
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
||||||
|
BigDecimal.valueOf(channelListDTO.getFAmp() * 1.05));
|
||||||
|
}
|
||||||
|
if(isPhaseAngle){
|
||||||
|
if(ObjectUtil.isNotNull(devPhase)){
|
||||||
|
isPhase = phaseBoolean(channelListDTO, devPhase);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
isPhase=true;
|
||||||
|
}
|
||||||
|
return isDev && isPhase;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1391,7 +1415,7 @@ public class SocketDevResponseService {
|
|||||||
* @param devPhase 装置返回角度
|
* @param devPhase 装置返回角度
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private static Boolean phaseBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devPhase) {
|
private Boolean phaseBoolean(SourceIssue.ChannelListDTO channelListDTO, Double devPhase) {
|
||||||
Double phase = devPhase;
|
Double phase = devPhase;
|
||||||
if (devPhase < -180) {
|
if (devPhase < -180) {
|
||||||
phase = devPhase + 360;
|
phase = devPhase + 360;
|
||||||
@@ -1603,8 +1627,8 @@ public class SocketDevResponseService {
|
|||||||
List<String> c = tem.getC();
|
List<String> c = tem.getC();
|
||||||
|
|
||||||
Class<AdHarmonicResult> example = (Class<AdHarmonicResult>) adHarmonicResult.getClass();
|
Class<AdHarmonicResult> example = (Class<AdHarmonicResult>) adHarmonicResult.getClass();
|
||||||
if(DicDataEnum.HSV.getCode().equals(sourceIssue.getType()) || DicDataEnum.HSI.getCode().equals(sourceIssue.getType())){
|
if (DicDataEnum.HSV.getCode().equals(sourceIssue.getType()) || DicDataEnum.HSI.getCode().equals(sourceIssue.getType())) {
|
||||||
for (int i = 1; i < a.size()+1; i++) {
|
for (int i = 1; i < a.size() + 1; i++) {
|
||||||
try {
|
try {
|
||||||
Field aField = example.getDeclaredField("aValue" + i);
|
Field aField = example.getDeclaredField("aValue" + i);
|
||||||
Field bField = example.getDeclaredField("bValue" + i);
|
Field bField = example.getDeclaredField("bValue" + i);
|
||||||
@@ -1620,8 +1644,8 @@ public class SocketDevResponseService {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
for (int i = 2; i <= a.size()+1; i++) {
|
for (int i = 2; i <= a.size() + 1; i++) {
|
||||||
try {
|
try {
|
||||||
Field aField = example.getDeclaredField("aValue" + i);
|
Field aField = example.getDeclaredField("aValue" + i);
|
||||||
Field bField = example.getDeclaredField("bValue" + i);
|
Field bField = example.getDeclaredField("bValue" + i);
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ spring:
|
|||||||
url: jdbc:mysql://192.168.1.24:13306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
url: jdbc:mysql://192.168.1.24:13306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||||
username: root
|
username: root
|
||||||
password: njcnpqs
|
password: njcnpqs
|
||||||
|
# url: jdbc:mysql://localhost:3306/pqs91001?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||||
|
# username: root
|
||||||
|
# password: root
|
||||||
#初始化建立物理连接的个数、最小、最大连接数
|
#初始化建立物理连接的个数、最小、最大连接数
|
||||||
initial-size: 5
|
initial-size: 5
|
||||||
min-idle: 5
|
min-idle: 5
|
||||||
@@ -41,15 +44,22 @@ mybatis-plus:
|
|||||||
#指定主键生成策略
|
#指定主键生成策略
|
||||||
id-type: assign_uuid
|
id-type: assign_uuid
|
||||||
|
|
||||||
|
phaseAngle:
|
||||||
|
isEnable: false
|
||||||
|
|
||||||
socket:
|
socket:
|
||||||
source:
|
source:
|
||||||
ip: 192.168.1.24
|
ip: 192.168.1.138
|
||||||
port: 62000
|
port: 62000
|
||||||
device:
|
device:
|
||||||
ip: 192.168.1.24
|
ip: 192.168.1.138
|
||||||
port: 61000
|
port: 61000
|
||||||
|
# source:
|
||||||
|
# ip: 192.168.1.121
|
||||||
|
# port: 10086
|
||||||
|
# device:
|
||||||
|
# ip: 192.168.1.121
|
||||||
|
# port: 61000
|
||||||
|
|
||||||
webSocket:
|
webSocket:
|
||||||
port: 7777
|
port: 7777
|
||||||
|
|||||||
Reference in New Issue
Block a user