运行策略测试修改

This commit is contained in:
zq
2026-01-15 14:45:28 +08:00
parent 3f4d3772b0
commit 9aa7dd9d18
10 changed files with 145 additions and 59 deletions

View File

@ -9,6 +9,9 @@ public class ProtectionSettingVo {
/** 设备 */
private String deviceId;
/** 设备名称 */
private String deviceName;
/** 点位 */
private String point;
@ -44,6 +47,14 @@ public class ProtectionSettingVo {
this.deviceId = deviceId;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getPoint() {
return point;
}

View File

@ -65,6 +65,6 @@ public interface EmsPointEnumMatchMapper
public int deleteEmsPointEnumMatchByIds(Long[] ids);
public List<EmsPointEnumMatch> selectList(@Param("siteId") String siteId,
@Param("deviceCategory") String deviceCategory,
@Param("matchField") String matchField);
@Param("deviceCategory") String deviceCategory,
@Param("matchField") String matchField);
}

View File

@ -622,8 +622,8 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
// 2. 处理枚举值转换
List<EmsPointEnumMatch> pointEnumMatchList = pointEnumMatchMap.get(fieldName);
if (CollectionUtils.isNotEmpty(pointEnumMatchList)) {
Object finalMatchValue = matchValue;
if (CollectionUtils.isNotEmpty(pointEnumMatchList) && matchValue != null) {
String finalMatchValue = String.valueOf(matchValue).replace(".0", "");
Optional<EmsPointEnumMatch> enumMatch = pointEnumMatchList.stream()
.filter(data -> data.getDataEnumCode().equals(finalMatchValue)).findFirst();
if (enumMatch.isPresent()) {
@ -928,7 +928,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
// 点位匹配数据
List<EmsPointMatch> pointMatchList = devicePointMatchDataProcessor.getDevicePointMatch(siteId, deviceId, DeviceMatchTable.CLUSTER.getCode());
if (CollectionUtils.isEmpty(pointMatchList)) {
log.info("未找到匹配的点位数据,无法处理LOAD总表数据siteId: " + siteId + "deviceId: " + deviceId);
log.info("未找到匹配的点位数据,无法处理电池簇数据siteId: " + siteId + "deviceId: " + deviceId);
return;
}
Map<String, List<EmsPointEnumMatch>> pointEnumMatchMap = devicePointMatchDataProcessor.getPointEnumMatchMap(siteId, DeviceMatchTable.CLUSTER.getCode());
@ -969,11 +969,11 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
}
private void saveDeviceWorkStatus(String deviceId, String siteId, String workStatus) {
if (StringUtils.isBlank(workStatus)) {
if (StringUtils.isEmpty(workStatus)) {
return;
}
EmsDevicesSetting emsDevicesSetting = emsDevicesSettingMapper.getDeviceBySiteAndDeviceId(deviceId, siteId);
emsDevicesSetting.setWorkStatus(String.valueOf(new BigDecimal(workStatus).longValue()));
emsDevicesSetting.setWorkStatus(workStatus);
emsDevicesSetting.setUpdatedAt(DateUtils.getNowDate());
emsDevicesSettingMapper.updateEmsDevicesSetting(emsDevicesSetting);
}

View File

@ -250,7 +250,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
String pointEnumMatchKey = DevicePointMatchDataProcessor.getPointEnumMacthCacheKey(siteId, deviceCategory);
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(siteId, deviceCategory, null);
if (!CollectionUtils.isEmpty(pointEnumMatchList)) {
if (redisCache.hasKey(pointEnumMatchKey)) {
if (Boolean.TRUE.equals(redisCache.hasKey(pointEnumMatchKey))) {
redisCache.deleteObject(pointEnumMatchKey);
}
redisCache.setCacheList(pointEnumMatchKey, pointEnumMatchList);
@ -263,8 +263,14 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
if (StringUtils.isAllBlank(matchFieldEnum, dataEnum)) {
return;
}
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(savePoint.getSiteId(), savePoint.getDeviceCategory(), savePoint.getMatchField());
String siteId = savePoint.getSiteId();
List<EmsPointEnumMatch> pointEnumMatchList = emsPointEnumMatchMapper.selectList(siteId, savePoint.getDeviceCategory(), savePoint.getMatchField());
if (CollectionUtils.isEmpty(pointEnumMatchList)) {
siteId = SITE_ID;
pointEnumMatchList = emsPointEnumMatchMapper.selectList(siteId, savePoint.getDeviceCategory(), savePoint.getMatchField());
}
if (CollectionUtils.isEmpty(pointEnumMatchList)) {
log.info("未查询到点位点位枚举匹配数据");
return;
}
String[] matchFieldEnums = matchFieldEnum.split(SEPARATOR);
@ -272,13 +278,21 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
if (matchFieldEnums.length != dataEnums.length) {
return;
}
String finalSiteId = siteId;
for (int i = 0; i < matchFieldEnums.length; i++) {
String enumName = matchFieldEnums[i];
String dataEnumCode = dataEnums[i];
pointEnumMatchList.forEach(pointEnumMatch -> {
if (pointEnumMatch.getEnumName().equals(enumName)) {
pointEnumMatch.setDataEnumCode(dataEnumCode);
emsPointEnumMatchMapper.updateDataEnumCodeById(pointEnumMatch);
if (SITE_ID.equals(finalSiteId)) {
EmsPointEnumMatch insertPointEnumMatch = new EmsPointEnumMatch();
BeanUtils.copyProperties(pointEnumMatch, insertPointEnumMatch);
insertPointEnumMatch.setSiteId(savePoint.getSiteId());
emsPointEnumMatchMapper.insertEmsPointEnumMatch(insertPointEnumMatch);
} else {
emsPointEnumMatchMapper.updateDataEnumCodeById(pointEnumMatch);
}
}
});
}