dev #2

Merged
dashixiong merged 349 commits from dev into main 2026-02-11 01:55:46 +00:00
375 changed files with 55746 additions and 1133 deletions
Showing only changes of commit e55cdc6504 - Show all commits

View File

@ -405,7 +405,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
//TODO 临时解决上送数据为浮点的问题
String status = dataStack.getWorkStatus();
int result = 0;
int result = 5;
if (status != null && !status.trim().isEmpty()) {
// 1.0 -> 1, 2.0 -> 2
@ -724,6 +724,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
//单体电池
Map<String, Map<String, Object>> records = processData(JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
}));
log.info("站点:{},单体电池数据:{}", siteId, records);
List<EmsBatteryData> list = new ArrayList<>();
List<EmsBatteryDataDailyLatest> dailyList = new ArrayList<>();
@ -739,6 +740,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
String batteryDeviceId = recordId + deviceId;
// 点位匹配数据
List<EmsPointMatch> pointMatchList = devicePointMatchDataProcessor.getDevicePointMatch(siteId, batteryDeviceId, DeviceMatchTable.BATTERY.getCode());
if (CollectionUtils.isEmpty(pointMatchList)) {
pointMatchList = devicePointMatchDataProcessor.getDeviceDefaultPointMatch(siteId, DeviceMatchTable.BATTERY.getCode());
} else {
@ -748,13 +750,15 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
}
fields = newFields;
}
if (CollectionUtils.isEmpty(pointMatchList)) {
log.info("未找到匹配的点位数据无法处理单体电池数据siteId: " + siteId + "deviceId: " + batteryDeviceId);
return;
}
EmsBatteryData batteryData = new EmsBatteryData();
batteryData.setDeviceId(recordId);
//TODO 单体电池 deviceid 拼接簇的 deviceid
batteryData.setDeviceId(recordId+deviceId);
batteryData.setBatteryCellId(recordId);
saveDeviceData(pointMatchList, fields, batteryData);
@ -997,7 +1001,7 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
//TODO 临时解决上送数据为浮点的问题 start
log.info("临时解决上送数据为浮点的问题");
String status = data.getWorkStatus();
int result = 0;
int result = 5;
if (status != null && !status.trim().isEmpty()) {
// 1.0 -> 1, 2.0 -> 2
result = (int) Double.parseDouble(status.trim());

View File

@ -192,14 +192,21 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
String parentDeviceId = request.getParentId();
String ipAddress = request.getIpAddress();
Integer ipPort = request.getIpPort();
log.info("处理点位清单deviceCategory"+ deviceCategory);
log.info("处理点位清单deviceId"+ deviceId);
log.info("处理点位清单parentDeviceId"+ parentDeviceId);
Integer isAlarm = request.getIsAlarm() == null ? PointType.NO.getCode() : request.getIsAlarm();
// 电动所的电池簇特殊处理-来源pcs+bmsd
if (siteId.equals(DDS_SITE_ID) && DeviceCategory.CLUSTER.getCode().equals(deviceCategory)) {
response = specialDealWithDDSCluster(siteId,deviceId,deviceCategory,dataPointName,dataPoint,ipAddress,ipPort,isAlarm);
} else if (DeviceCategory.BATTERY.getCode().equals(deviceCategory)) {
log.info("单体电池处理parentdeviceId"+ parentDeviceId);
response = specialDealWithBattery(siteId,deviceId,deviceCategory,
dataPointName,dataPoint,parentDeviceId,ipAddress,ipPort,isAlarm);
} else {
log.info("处理点位清单ELSE");
response = emsPointMatchMapper.getSingleSiteDevicePoints(
siteId,deviceId,deviceCategory,dataPointName,dataPoint,ipAddress,ipPort,isAlarm);
String redisDataKey = RedisKeyConstants.ORIGINAL_MQTT_DATA;
@ -301,18 +308,20 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
if (PointType.YES.getCode().equals(isAlarm)) {
redisDataKey = RedisKeyConstants.ORIGINAL_MQTT_DATA_ALARM;
}
if (SiteEnum.DDS.getCode().equals(siteId)) {
// dds单体电池数据来源于BMSD
EmsDevicesSetting clusterDevice = emsDevicesMapper.getDeviceBySiteAndDeviceId(parentDeviceId,siteId);
String bmsdDeviceId = clusterDevice == null ? "" :clusterDevice.getParentId();
if (StringUtils.isEmpty(bmsdDeviceId)) {
return response;
}
jsonObject = redisCache.getCacheObject(redisDataKey + siteId + "_" + bmsdDeviceId);
} else if (SiteEnum.FX.getCode().equals(siteId)) {
//TODO 单体电池数据统一有 BMSC 提供
// if (SiteEnum.DDS.getCode().equals(siteId)) {
// // dds单体电池数据来源于BMSD
// EmsDevicesSetting clusterDevice = emsDevicesMapper.getDeviceBySiteAndDeviceId(parentDeviceId,siteId);
// String bmsdDeviceId = clusterDevice == null ? "" :clusterDevice.getParentId();
// if (StringUtils.isEmpty(bmsdDeviceId)) {
// return response;
// }
// jsonObject = redisCache.getCacheObject(redisDataKey + siteId + "_" + bmsdDeviceId);
// } else if (SiteEnum.FX.getCode().equals(siteId)) {
// fx单体电池数据来源于父类簇BMSC
jsonObject = redisCache.getCacheObject(redisDataKey + siteId + "_" + parentDeviceId);
}
jsonObject = redisCache.getCacheObject(redisDataKey + siteId + "_" + parentDeviceId);
// }
log.info("点位 key"+redisDataKey+ ",点位数据:"+jsonObject);
if (jsonObject != null) {
// 填充数据
fillBatteryData(jsonObject,siteId, deviceId, response);
@ -325,19 +334,28 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
if (StringUtils.isEmpty(jsonData)) {
return;
}
//TODO deviceId 获取前三位
String xdeviceId = "";
if (deviceId != null && deviceId.length()>3) {
xdeviceId = deviceId.substring(0, 3);
}
Map<String, Object> obj = JSON.parseObject(jsonData, new TypeReference<Map<String, Object>>() {
});
log.info("单体电池的点位数据组合 obj:"+JSON.toJSONString(obj));
Long updateTime = Long.valueOf(jsonObject.get("timestamp").toString());
Date dataUpdateTime = DateUtils.convertUpdateTime(updateTime);
// 遍历点位数据,设最新值
for (PointQueryResponse pointInfo : response) {
String dataKey = "";
if (SiteEnum.DDS.getCode().equals(siteId)) {
dataKey = "DTDC" + deviceId + pointInfo.getDataPoint();
} else if (SiteEnum.FX.getCode().equals(siteId)) {
dataKey = pointInfo.getDataPoint() + deviceId;
}
pointInfo.setPointValue(obj.get(dataKey));
//TODO 统一处理单体电池逻辑
// if (SiteEnum.DDS.getCode().equals(siteId)) {
// dataKey = "DTDC" + xdeviceId + pointInfo.getDataPoint();
// log.info("单体电池的点位数据组合 dataKey:"+dataKey);
// } else if (SiteEnum.FX.getCode().equals(siteId)) {
// dataKey = pointInfo.getDataPoint();
log.info("单体电池的点位数据组合 dataKey:"+dataKey);
// }
pointInfo.setPointValue(obj.get(pointInfo.getDataPoint()));
pointInfo.setUpdateTime(dataUpdateTime);
}
}

View File

@ -711,11 +711,12 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
}
}
}
//TODO 临时删除排序
// 排序
List<BatteryDataStatsListVo> sortedList = batteryDataStatsListVo.stream()
.sorted((u1, u2) -> Integer.parseInt(u1.getDeviceId()) - Integer.parseInt(u2.getDeviceId()))
.collect(Collectors.toList());
return sortedList;
// List<BatteryDataStatsListVo> sortedList = batteryDataStatsListVo.stream()
// .sorted((u1, u2) -> Integer.parseInt(u1.getClusterDeviceId()) - Integer.parseInt(u2.getClusterDeviceId()))
// .collect(Collectors.toList());
return batteryDataStatsListVo;
}
// 获取单站的最大最小温度和电压单体数据id