解决本地端解析数据报错问题
This commit is contained in:
@ -312,7 +312,7 @@ public class ModbusProcessor {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HOLDING_REGISTER: {
|
case HOLDING_REGISTER: {
|
||||||
logger.info("HOLDING_REGISTER: {}",tag.getAddress());
|
// logger.info("HOLDING_REGISTER: {}",tag.getAddress());
|
||||||
if (dataLength == 28){
|
if (dataLength == 28){
|
||||||
BaseLocator<Number> locator = BaseLocator.holdingRegister(slaveId, address, 4);
|
BaseLocator<Number> locator = BaseLocator.holdingRegister(slaveId, address, 4);
|
||||||
batch.addLocator(tag.getKey(), locator);
|
batch.addLocator(tag.getKey(), locator);
|
||||||
@ -323,7 +323,7 @@ public class ModbusProcessor {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INPUT_REGISTER: {
|
case INPUT_REGISTER: {
|
||||||
logger.info("INPUT_REGISTER: {}",tag.getAddress());
|
// logger.info("INPUT_REGISTER: {}",tag.getAddress());
|
||||||
BaseLocator<Number> loc = BaseLocator.inputRegister(slaveId, address, dataLength);
|
BaseLocator<Number> loc = BaseLocator.inputRegister(slaveId, address, dataLength);
|
||||||
batch.addLocator(tag.getKey(), loc);
|
batch.addLocator(tag.getKey(), loc);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1165,13 +1165,16 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
// dds存的是累计到昨日总收益
|
// dds存的是累计到昨日总收益
|
||||||
String yestDate = DateUtils.getYesterdayDayString();
|
String yestDate = DateUtils.getYesterdayDayString();
|
||||||
String redisKey = RedisKeyConstants.DDS_TOTAL_REVENUE + siteId + "_" + yestDate;
|
String redisKey = RedisKeyConstants.DDS_TOTAL_REVENUE + siteId + "_" + yestDate;
|
||||||
BigDecimal yestLastTotalRevenue = redisCache.getCacheObject(redisKey);
|
Object cacheObject = redisCache.getCacheObject(redisKey);
|
||||||
if (yestLastTotalRevenue == null) {
|
BigDecimal yestLastTotalRevenue;
|
||||||
|
if (cacheObject == null) {
|
||||||
yestLastTotalRevenue = emsDailyEnergyDataMapper.getLastTotalRevenue(siteId);
|
yestLastTotalRevenue = emsDailyEnergyDataMapper.getLastTotalRevenue(siteId);
|
||||||
if (yestLastTotalRevenue == null) {
|
if (yestLastTotalRevenue == null) {
|
||||||
yestLastTotalRevenue = BigDecimal.ZERO;
|
yestLastTotalRevenue = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
redisCache.setCacheObject(redisKey, yestLastTotalRevenue, 1, TimeUnit.DAYS);
|
redisCache.setCacheObject(redisKey, yestLastTotalRevenue, 1, TimeUnit.DAYS);
|
||||||
|
} else {
|
||||||
|
yestLastTotalRevenue = (BigDecimal) cacheObject;
|
||||||
}
|
}
|
||||||
return yestLastTotalRevenue;
|
return yestLastTotalRevenue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import com.xzzn.common.core.modbus.domain.WriteTagConfig;
|
|||||||
import com.xzzn.common.core.redis.RedisCache;
|
import com.xzzn.common.core.redis.RedisCache;
|
||||||
import com.xzzn.common.enums.DeviceCategory;
|
import com.xzzn.common.enums.DeviceCategory;
|
||||||
import com.xzzn.common.enums.DeviceRunningStatus;
|
import com.xzzn.common.enums.DeviceRunningStatus;
|
||||||
import com.xzzn.common.enums.DeviceType;
|
|
||||||
import com.xzzn.common.enums.PcsControlCommand;
|
import com.xzzn.common.enums.PcsControlCommand;
|
||||||
import com.xzzn.common.enums.PointType;
|
import com.xzzn.common.enums.PointType;
|
||||||
import com.xzzn.common.enums.SiteEnum;
|
import com.xzzn.common.enums.SiteEnum;
|
||||||
@ -540,10 +539,10 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
|
|||||||
deviceConfig.setDeviceNumber(device.getDeviceId());
|
deviceConfig.setDeviceNumber(device.getDeviceId());
|
||||||
deviceConfig.setDeviceName(device.getDeviceName());
|
deviceConfig.setDeviceName(device.getDeviceName());
|
||||||
deviceConfig.setSlaveId(device.getSlaveId().intValue());
|
deviceConfig.setSlaveId(device.getSlaveId().intValue());
|
||||||
if (DeviceType.TCP.name().equals(device.getDeviceType())) {
|
// if (DeviceType.TCP.name().equals(device.getDeviceType())) {
|
||||||
deviceConfig.setHost(device.getIpAddress());
|
deviceConfig.setHost(device.getIpAddress());
|
||||||
deviceConfig.setPort(device.getIpPort().intValue());
|
deviceConfig.setPort(device.getIpPort().intValue());
|
||||||
}
|
// }
|
||||||
|
|
||||||
return deviceConfig;
|
return deviceConfig;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,30 @@
|
|||||||
package com.xzzn.ems.service.impl;
|
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.alibaba.fastjson2.JSON;
|
||||||
import com.xzzn.common.core.redis.RedisCache;
|
import com.xzzn.common.core.redis.RedisCache;
|
||||||
import com.xzzn.common.enums.PointType;
|
import com.xzzn.common.enums.PointType;
|
||||||
import com.xzzn.common.exception.ServiceException;
|
import com.xzzn.common.exception.ServiceException;
|
||||||
import com.xzzn.common.utils.StringUtils;
|
import com.xzzn.common.utils.StringUtils;
|
||||||
import com.xzzn.common.utils.bean.BeanValidators;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -22,20 +35,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
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业务层处理
|
* 点位匹配Service业务层处理
|
||||||
*
|
*
|
||||||
@ -206,7 +205,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
|||||||
savePointMatchEnum(pointMatch.getMatchFieldEnum(), pointMatch.getDataEnum(), savePoint);
|
savePointMatchEnum(pointMatch.getMatchFieldEnum(), pointMatch.getDataEnum(), savePoint);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("点位清单导入失败:{}", e.getMessage());
|
e.printStackTrace();
|
||||||
throw new ServiceException("点位清单导入失败!");
|
throw new ServiceException("点位清单导入失败!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user