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);
|
||||||
|
|
||||||
@@ -1285,15 +1287,24 @@ 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(isPhaseAngle){
|
||||||
|
if(CollUtil.isNotEmpty(data)&&CollUtil.isNotEmpty(dataPhase)){
|
||||||
if (data.size() == dataPhase.size()) {
|
if (data.size() == dataPhase.size()) {
|
||||||
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
||||||
DevData.SqlDataDTO.ListDTO phase = dataPhase.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()) + "° " +
|
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 + "b=" + String.format("%.4f", dto.getB()) + ",相角=" + String.format("%.4f", phase.getB()) + "° " +
|
||||||
type + "c=" + String.format("%.4f", dto.getC()) + ",相角=" + String.format("%.4f", phase.getC()) + "° ");
|
type + "c=" + String.format("%.4f", dto.getC()) + ",相角=" + String.format("%.4f", phase.getC()) + "° ");
|
||||||
str.append(")");
|
str.append(")");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
DevData.SqlDataDTO.ListDTO dto = data.get(0).getList();
|
||||||
|
str.append("装置(" + type + "a=" + String.format("%.4f", dto.getA()) +
|
||||||
|
type + "b=" + String.format("%.4f", dto.getB()) +
|
||||||
|
type + "c=" + String.format("%.4f", dto.getC()) );
|
||||||
|
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;
|
||||||
|
Boolean isPhase = false;
|
||||||
|
if(ObjectUtil.isNotNull(devData)){
|
||||||
|
isDev= NumberUtil.isIn(BigDecimal.valueOf(devData),
|
||||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
BigDecimal.valueOf(channelListDTO.getFAmp() * 0.95),
|
||||||
BigDecimal.valueOf(channelListDTO.getFAmp() * 1.05))
|
BigDecimal.valueOf(channelListDTO.getFAmp() * 1.05));
|
||||||
&&
|
}
|
||||||
phaseBoolean(channelListDTO, devPhase);
|
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;
|
||||||
|
|||||||
@@ -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