解决本地端解析数据报错问题

This commit is contained in:
zq
2025-12-19 16:41:49 +08:00
parent 2cd4040431
commit 289fd37e2b
4 changed files with 31 additions and 30 deletions

View File

@ -1165,13 +1165,16 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
// dds存的是累计到昨日总收益
String yestDate = DateUtils.getYesterdayDayString();
String redisKey = RedisKeyConstants.DDS_TOTAL_REVENUE + siteId + "_" + yestDate;
BigDecimal yestLastTotalRevenue = redisCache.getCacheObject(redisKey);
if (yestLastTotalRevenue == null) {
Object cacheObject = redisCache.getCacheObject(redisKey);
BigDecimal yestLastTotalRevenue;
if (cacheObject == null) {
yestLastTotalRevenue = emsDailyEnergyDataMapper.getLastTotalRevenue(siteId);
if (yestLastTotalRevenue == null) {
yestLastTotalRevenue = BigDecimal.ZERO;
}
redisCache.setCacheObject(redisKey, yestLastTotalRevenue, 1, TimeUnit.DAYS);
} else {
yestLastTotalRevenue = (BigDecimal) cacheObject;
}
return yestLastTotalRevenue;
}

View File

@ -10,7 +10,6 @@ import com.xzzn.common.core.modbus.domain.WriteTagConfig;
import com.xzzn.common.core.redis.RedisCache;
import com.xzzn.common.enums.DeviceCategory;
import com.xzzn.common.enums.DeviceRunningStatus;
import com.xzzn.common.enums.DeviceType;
import com.xzzn.common.enums.PcsControlCommand;
import com.xzzn.common.enums.PointType;
import com.xzzn.common.enums.SiteEnum;
@ -540,10 +539,10 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
deviceConfig.setDeviceNumber(device.getDeviceId());
deviceConfig.setDeviceName(device.getDeviceName());
deviceConfig.setSlaveId(device.getSlaveId().intValue());
if (DeviceType.TCP.name().equals(device.getDeviceType())) {
deviceConfig.setHost(device.getIpAddress());
deviceConfig.setPort(device.getIpPort().intValue());
}
// if (DeviceType.TCP.name().equals(device.getDeviceType())) {
deviceConfig.setHost(device.getIpAddress());
deviceConfig.setPort(device.getIpPort().intValue());
// }
return deviceConfig;
}

View File

@ -1,17 +1,30 @@
package com.xzzn.ems.service.impl;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.alibaba.fastjson2.JSON;
import com.xzzn.common.core.redis.RedisCache;
import com.xzzn.common.enums.PointType;
import com.xzzn.common.exception.ServiceException;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.common.utils.bean.BeanValidators;
import com.xzzn.common.utils.poi.ExcelUtil;
import com.xzzn.ems.domain.EmsPointEnumMatch;
import com.xzzn.ems.domain.EmsPointMatch;
import com.xzzn.ems.domain.vo.DevicePointMatchExportVo;
import com.xzzn.ems.domain.vo.DevicePointMatchVo;
import com.xzzn.ems.domain.vo.ImportPointDataRequest;
import com.xzzn.ems.enums.DeviceMatchTable;
import com.xzzn.ems.mapper.EmsPointEnumMatchMapper;
import com.xzzn.ems.mapper.EmsPointMatchMapper;
import com.xzzn.ems.service.IEmsPointMatchService;
import com.xzzn.ems.utils.DevicePointMatchDataProcessor;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import javax.validation.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -22,20 +35,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import com.xzzn.common.utils.poi.ExcelUtil;
import com.xzzn.ems.domain.EmsPointEnumMatch;
import com.xzzn.ems.domain.vo.DevicePointMatchExportVo;
import com.xzzn.ems.domain.vo.DevicePointMatchVo;
import com.xzzn.ems.domain.vo.ImportPointDataRequest;
import com.xzzn.ems.enums.DeviceMatchTable;
import com.xzzn.ems.mapper.EmsPointEnumMatchMapper;
import com.xzzn.ems.mapper.EmsPointMatchMapper;
import com.xzzn.ems.domain.EmsPointMatch;
import com.xzzn.ems.service.IEmsPointMatchService;
import com.xzzn.ems.utils.DevicePointMatchDataProcessor;
import javax.validation.Validator;
/**
* 点位匹配Service业务层处理
*
@ -206,7 +205,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
savePointMatchEnum(pointMatch.getMatchFieldEnum(), pointMatch.getDataEnum(), savePoint);
} catch (Exception e) {
log.info("点位清单导入失败:{}", e.getMessage());
e.printStackTrace();
throw new ServiceException("点位清单导入失败!");
}
}