平台修改意见20251120-点位上传根据设备ID区分
This commit is contained in:
@ -87,6 +87,11 @@ public class RedisKeyConstants
|
|||||||
*/
|
*/
|
||||||
public static final String ORIGINAL_MQTT_DATA = "MQTT_";
|
public static final String ORIGINAL_MQTT_DATA = "MQTT_";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存放单个设备同步过来的告警点位原始数据-最晚一次数据
|
||||||
|
*/
|
||||||
|
public static final String ORIGINAL_MQTT_DATA_ALARM = "MQTT_ALARM_";
|
||||||
|
|
||||||
/** 存放订阅失败告警信息 */
|
/** 存放订阅失败告警信息 */
|
||||||
public static final String TOPIC_FAILED_ALRAM_RECORD = "topic_failed_";
|
public static final String TOPIC_FAILED_ALRAM_RECORD = "topic_failed_";
|
||||||
/** topic 内没有数据设备维度告警 */
|
/** topic 内没有数据设备维度告警 */
|
||||||
@ -110,4 +115,7 @@ public class RedisKeyConstants
|
|||||||
|
|
||||||
/** 每个设备最新数据-设置失效时间-判断是否正常同步数据 */
|
/** 每个设备最新数据-设置失效时间-判断是否正常同步数据 */
|
||||||
public static final String SYNC_DATA= "SYNC_DATA_";
|
public static final String SYNC_DATA= "SYNC_DATA_";
|
||||||
|
|
||||||
|
/** 每个设备最新数据-设置失效时间-判断是否正常同步数据 */
|
||||||
|
public static final String SYNC_DATA_ALARM = "SYNC_DATA_ALARM_";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -74,6 +74,10 @@ public class EmsPointMatch extends BaseEntity
|
|||||||
@Excel(name = "是否告警点位", readConverterExp = "0=否,1=是")
|
@Excel(name = "是否告警点位", readConverterExp = "0=否,1=是")
|
||||||
private Integer isAlarm;
|
private Integer isAlarm;
|
||||||
|
|
||||||
|
/** 设备唯一标识符 */
|
||||||
|
@Excel(name = "设备唯一标识符")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -220,6 +224,14 @@ public class EmsPointMatch extends BaseEntity
|
|||||||
this.isAlarm = isAlarm;
|
this.isAlarm = isAlarm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(String deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
@ -243,6 +255,7 @@ public class EmsPointMatch extends BaseEntity
|
|||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
.append("remark", getRemark())
|
.append("remark", getRemark())
|
||||||
.append("isAlarm", getIsAlarm())
|
.append("isAlarm", getIsAlarm())
|
||||||
|
.append("deviceId", getDeviceId())
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,9 @@ public class ImportPointDataRequest {
|
|||||||
/** 站点id */
|
/** 站点id */
|
||||||
@NotBlank(message = "站点ID不能为空")
|
@NotBlank(message = "站点ID不能为空")
|
||||||
private String siteId;
|
private String siteId;
|
||||||
|
/** 设备id */
|
||||||
|
@NotBlank(message = "设备ID不能为空")
|
||||||
|
private String deviceId;
|
||||||
/** 设备类型 */
|
/** 设备类型 */
|
||||||
@NotBlank(message = "设备类型不能为空")
|
@NotBlank(message = "设备类型不能为空")
|
||||||
private String deviceCategory;
|
private String deviceCategory;
|
||||||
@ -32,6 +35,14 @@ public class ImportPointDataRequest {
|
|||||||
this.siteId = siteId;
|
this.siteId = siteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(String deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
public String getDeviceCategory() {
|
public String getDeviceCategory() {
|
||||||
return deviceCategory;
|
return deviceCategory;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,6 +141,7 @@ public interface EmsPointMatchMapper
|
|||||||
|
|
||||||
// 单个站点单个设备点位查询-除了电池簇其他设备使用
|
// 单个站点单个设备点位查询-除了电池簇其他设备使用
|
||||||
public List<PointQueryResponse> getSingleSiteDevicePoints(@Param("siteId")String siteId,
|
public List<PointQueryResponse> getSingleSiteDevicePoints(@Param("siteId")String siteId,
|
||||||
|
@Param("deviceId")String deviceId,
|
||||||
@Param("deviceCategory")String deviceCategory,
|
@Param("deviceCategory")String deviceCategory,
|
||||||
@Param("pointName")String pointName,
|
@Param("pointName")String pointName,
|
||||||
@Param("dataPoint")String dataPoint,
|
@Param("dataPoint")String dataPoint,
|
||||||
@ -161,9 +162,9 @@ public interface EmsPointMatchMapper
|
|||||||
// 根据站点,设备类别,点位,获取唯一数据
|
// 根据站点,设备类别,点位,获取唯一数据
|
||||||
public EmsPointMatch getUniquePoint(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory, @Param("dataPoint")String dataPoint);
|
public EmsPointMatch getUniquePoint(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory, @Param("dataPoint")String dataPoint);
|
||||||
|
|
||||||
EmsPointMatch getOnePointMatch(@Param("siteId") String siteId, @Param("deviceCategory") String deviceCategory, @Param("dataPoint") String dataPoint);
|
EmsPointMatch getOnePointMatch(@Param("siteId") String siteId, @Param("deviceId") String deviceId, @Param("deviceCategory") String deviceCategory, @Param("dataPoint") String dataPoint);
|
||||||
|
|
||||||
List<EmsPointMatch> getDevicePointMatchList(@Param("siteId") String siteId, @Param("deviceCategory") String deviceCategory);
|
List<EmsPointMatch> getDevicePointMatchList(@Param("siteId") String siteId, @Param("deviceId") String deviceId, @Param("deviceCategory") String deviceCategory);
|
||||||
|
|
||||||
List<DevicePointMatchExportVo> selectEmsPointMatchExportList(EmsPointMatch emsPointMatch);
|
List<DevicePointMatchExportVo> selectEmsPointMatchExportList(EmsPointMatch emsPointMatch);
|
||||||
|
|
||||||
|
|||||||
@ -1405,6 +1405,12 @@ public class DeviceDataProcessServiceImpl extends AbstractBatteryDataProcessor i
|
|||||||
Date dataUpdateTime = DateUtils.convertUpdateTime(timestamp);
|
Date dataUpdateTime = DateUtils.convertUpdateTime(timestamp);
|
||||||
|
|
||||||
log.info("deviceId:" + deviceId);
|
log.info("deviceId:" + deviceId);
|
||||||
|
|
||||||
|
// 存放mqtt原始每个设备最晚一次数据,便于后面点位获取数据
|
||||||
|
redisCache.setCacheObject(RedisKeyConstants.ORIGINAL_MQTT_DATA_ALARM + siteId + "_" + deviceId, obj);
|
||||||
|
// 存放每次同步数据,失效时间(同同步时间)-用于判断是否正常同步数据
|
||||||
|
redisCache.setCacheObject(RedisKeyConstants.SYNC_DATA_ALARM + siteId + "_" + deviceId, obj, 1, TimeUnit.MINUTES);
|
||||||
|
|
||||||
String deviceCategory = "";
|
String deviceCategory = "";
|
||||||
if (deviceId.contains(SiteDevice.ZSLQ.name())) {
|
if (deviceId.contains(SiteDevice.ZSLQ.name())) {
|
||||||
coolingAlarmDataProcess(siteId, deviceId, jsonData, dataUpdateTime);
|
coolingAlarmDataProcess(siteId, deviceId, jsonData, dataUpdateTime);
|
||||||
|
|||||||
@ -152,9 +152,13 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
|
|||||||
dataPointName,dataPoint,parentDeviceId,ipAddress,ipPort,isAlarm);
|
dataPointName,dataPoint,parentDeviceId,ipAddress,ipPort,isAlarm);
|
||||||
} else {
|
} else {
|
||||||
response = emsPointMatchMapper.getSingleSiteDevicePoints(
|
response = emsPointMatchMapper.getSingleSiteDevicePoints(
|
||||||
siteId,deviceCategory,dataPointName,dataPoint,ipAddress,ipPort,isAlarm);
|
siteId,deviceId,deviceCategory,dataPointName,dataPoint,ipAddress,ipPort,isAlarm);
|
||||||
|
String redisDataKey = RedisKeyConstants.ORIGINAL_MQTT_DATA;
|
||||||
|
if (PointType.YES.getCode().equals(isAlarm)) {
|
||||||
|
redisDataKey = RedisKeyConstants.ORIGINAL_MQTT_DATA_ALARM;
|
||||||
|
}
|
||||||
// 从redis取最新数据
|
// 从redis取最新数据
|
||||||
JSONObject mqttJson = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_MQTT_DATA + siteId + "_" + deviceId);
|
JSONObject mqttJson = redisCache.getCacheObject(redisDataKey + siteId + "_" + deviceId);
|
||||||
if(mqttJson == null){
|
if(mqttJson == null){
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@ -239,11 +243,15 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
|
|||||||
private List<PointQueryResponse> specialDealWithBattery(String siteId, String deviceId, String deviceCategory,
|
private List<PointQueryResponse> specialDealWithBattery(String siteId, String deviceId, String deviceCategory,
|
||||||
String dataPointName, String dataPoint, String parentDeviceId,
|
String dataPointName, String dataPoint, String parentDeviceId,
|
||||||
String ipAddress, Integer ipPort, Integer isAlarm) {
|
String ipAddress, Integer ipPort, Integer isAlarm) {
|
||||||
List<PointQueryResponse> response = emsPointMatchMapper.getSingleSiteDevicePoints(siteId,deviceCategory,
|
List<PointQueryResponse> response = emsPointMatchMapper.getSingleSiteDevicePoints(siteId,deviceId,deviceCategory,
|
||||||
dataPointName,dataPoint,ipAddress,ipPort,isAlarm);
|
dataPointName,dataPoint,ipAddress,ipPort,isAlarm);
|
||||||
|
|
||||||
// 获取redis同步最新数据
|
// 获取redis同步最新数据
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
String redisDataKey = RedisKeyConstants.ORIGINAL_MQTT_DATA;
|
||||||
|
if (PointType.YES.getCode().equals(isAlarm)) {
|
||||||
|
redisDataKey = RedisKeyConstants.ORIGINAL_MQTT_DATA_ALARM;
|
||||||
|
}
|
||||||
if (SiteEnum.DDS.getCode().equals(siteId)) {
|
if (SiteEnum.DDS.getCode().equals(siteId)) {
|
||||||
// dds单体电池数据来源于BMSD
|
// dds单体电池数据来源于BMSD
|
||||||
EmsDevicesSetting clusterDevice = emsDevicesMapper.getDeviceBySiteAndDeviceId(parentDeviceId,siteId);
|
EmsDevicesSetting clusterDevice = emsDevicesMapper.getDeviceBySiteAndDeviceId(parentDeviceId,siteId);
|
||||||
@ -251,10 +259,10 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
|
|||||||
if (StringUtils.isEmpty(bmsdDeviceId)) {
|
if (StringUtils.isEmpty(bmsdDeviceId)) {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
jsonObject = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_MQTT_DATA + siteId + "_" + bmsdDeviceId);
|
jsonObject = redisCache.getCacheObject(redisDataKey + siteId + "_" + bmsdDeviceId);
|
||||||
} else if (SiteEnum.FX.getCode().equals(siteId)) {
|
} else if (SiteEnum.FX.getCode().equals(siteId)) {
|
||||||
// fx单体电池数据来源于父类簇BMSC
|
// fx单体电池数据来源于父类簇BMSC
|
||||||
jsonObject = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_MQTT_DATA + siteId + "_" + parentDeviceId);
|
jsonObject = redisCache.getCacheObject(redisDataKey + siteId + "_" + parentDeviceId);
|
||||||
}
|
}
|
||||||
if (jsonObject != null) {
|
if (jsonObject != null) {
|
||||||
// 填充数据
|
// 填充数据
|
||||||
@ -329,15 +337,19 @@ public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
|
|||||||
|
|
||||||
|
|
||||||
JSONObject mergedData = new JSONObject();
|
JSONObject mergedData = new JSONObject();
|
||||||
|
String redisDataKey = RedisKeyConstants.ORIGINAL_MQTT_DATA;
|
||||||
|
if (PointType.YES.getCode().equals(isAlarm)) {
|
||||||
|
redisDataKey = RedisKeyConstants.ORIGINAL_MQTT_DATA_ALARM;
|
||||||
|
}
|
||||||
|
|
||||||
// 数据来源pcs
|
// 数据来源pcs
|
||||||
JSONObject pcsJson = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_MQTT_DATA + siteId + "_PCS");
|
JSONObject pcsJson = redisCache.getCacheObject(redisDataKey + siteId + "_PCS");
|
||||||
if (pcsJson != null) {
|
if (pcsJson != null) {
|
||||||
JSONObject data = pcsJson.getJSONObject("Data");
|
JSONObject data = pcsJson.getJSONObject("Data");
|
||||||
mergedData.putAll(data);
|
mergedData.putAll(data);
|
||||||
}
|
}
|
||||||
// 根据deviceId获取父类bmsd
|
// 根据deviceId获取父类bmsd
|
||||||
JSONObject bmsdJson = redisCache.getCacheObject(RedisKeyConstants.ORIGINAL_MQTT_DATA + siteId + "_" + bmsdDeviceId);
|
JSONObject bmsdJson = redisCache.getCacheObject(redisDataKey + siteId + "_" + bmsdDeviceId);
|
||||||
if (bmsdJson != null) {
|
if (bmsdJson != null) {
|
||||||
JSONObject data = bmsdJson.getJSONObject("Data");
|
JSONObject data = bmsdJson.getJSONObject("Data");
|
||||||
mergedData.putAll(data);
|
mergedData.putAll(data);
|
||||||
|
|||||||
@ -51,6 +51,8 @@ import javax.validation.Validator;
|
|||||||
public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
||||||
private static final Logger log = LoggerFactory.getLogger(EmsPointMatchServiceImpl.class);
|
private static final Logger log = LoggerFactory.getLogger(EmsPointMatchServiceImpl.class);
|
||||||
private static final String SEPARATOR = "#";
|
private static final String SEPARATOR = "#";
|
||||||
|
|
||||||
|
private static final String SITE_ID = "DEFAULT";
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmsPointMatchMapper emsPointMatchMapper;
|
private EmsPointMatchMapper emsPointMatchMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -68,6 +70,9 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DevicePointMatchExportVo> selectEmsPointMatchList(EmsPointMatch emsPointMatch) {
|
public List<DevicePointMatchExportVo> selectEmsPointMatchList(EmsPointMatch emsPointMatch) {
|
||||||
|
if (StringUtils.isBlank(emsPointMatch.getDeviceId())) {
|
||||||
|
emsPointMatch.setSiteId(SITE_ID);
|
||||||
|
}
|
||||||
List<DevicePointMatchExportVo> devicePointMatchExportVos = emsPointMatchMapper.selectEmsPointMatchExportList(emsPointMatch);
|
List<DevicePointMatchExportVo> devicePointMatchExportVos = emsPointMatchMapper.selectEmsPointMatchExportList(emsPointMatch);
|
||||||
if (CollectionUtils.isEmpty(devicePointMatchExportVos)) {
|
if (CollectionUtils.isEmpty(devicePointMatchExportVos)) {
|
||||||
return devicePointMatchExportVos;
|
return devicePointMatchExportVos;
|
||||||
@ -171,6 +176,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String siteId = request.getSiteId();
|
String siteId = request.getSiteId();
|
||||||
|
String deviceId = request.getDeviceId();
|
||||||
String deviceCategory = request.getDeviceCategory();
|
String deviceCategory = request.getDeviceCategory();
|
||||||
List<DevicePointMatchVo> errorList = new ArrayList<>();
|
List<DevicePointMatchVo> errorList = new ArrayList<>();
|
||||||
for (DevicePointMatchVo pointMatch : pointMatchList) {
|
for (DevicePointMatchVo pointMatch : pointMatchList) {
|
||||||
@ -193,7 +199,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
|||||||
savePoint.setCreateBy(operName);
|
savePoint.setCreateBy(operName);
|
||||||
savePoint.setUpdateBy(operName);
|
savePoint.setUpdateBy(operName);
|
||||||
// 验证点位是否存在
|
// 验证点位是否存在
|
||||||
EmsPointMatch dbPoint = emsPointMatchMapper.getOnePointMatch(siteId, deviceCategory, pointMatch.getDataPoint());
|
EmsPointMatch dbPoint = emsPointMatchMapper.getOnePointMatch(siteId, deviceId, deviceCategory, pointMatch.getDataPoint());
|
||||||
if (Objects.isNull(dbPoint)) {
|
if (Objects.isNull(dbPoint)) {
|
||||||
emsPointMatchMapper.insertEmsPointMatch(savePoint);
|
emsPointMatchMapper.insertEmsPointMatch(savePoint);
|
||||||
} else {
|
} else {
|
||||||
@ -209,7 +215,7 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 同步到Redis
|
// 同步到Redis
|
||||||
syncToRedis(siteId, deviceCategory);
|
syncToRedis(siteId, deviceId, deviceCategory);
|
||||||
return errorList;
|
return errorList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,10 +238,10 @@ public class EmsPointMatchServiceImpl implements IEmsPointMatchService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncToRedis(String siteId, String deviceCategory) {
|
private void syncToRedis(String siteId, String deviceId, String deviceCategory) {
|
||||||
// 点位匹配数据同步到Redis
|
// 点位匹配数据同步到Redis
|
||||||
String pointMatchKey = DevicePointMatchDataProcessor.getPointMacthCacheKey(siteId, deviceCategory);
|
String pointMatchKey = DevicePointMatchDataProcessor.getPointMacthCacheKey(siteId, deviceId, deviceCategory);
|
||||||
List<EmsPointMatch> pointMatchData = emsPointMatchMapper.getDevicePointMatchList(siteId, deviceCategory);
|
List<EmsPointMatch> pointMatchData = emsPointMatchMapper.getDevicePointMatchList(siteId, deviceId, deviceCategory);
|
||||||
// log.info("同步点位匹配数据到Redis key:{} data:{}", pointMatchKey, pointMatchData);
|
// log.info("同步点位匹配数据到Redis key:{} data:{}", pointMatchKey, pointMatchData);
|
||||||
if (redisCache.hasKey(pointMatchKey)) {
|
if (redisCache.hasKey(pointMatchKey)) {
|
||||||
redisCache.deleteObject(pointMatchKey);
|
redisCache.deleteObject(pointMatchKey);
|
||||||
|
|||||||
@ -104,9 +104,9 @@ public class DevicePointMatchDataProcessor {
|
|||||||
// log.info("未找到设备配置信息,siteId: " + siteId + ", deviceId: "+ deviceId);
|
// log.info("未找到设备配置信息,siteId: " + siteId + ", deviceId: "+ deviceId);
|
||||||
// return pointMatchList;
|
// return pointMatchList;
|
||||||
// }
|
// }
|
||||||
List<EmsPointMatch> pointMatchList = redisCache.getCacheList(getPointMacthCacheKey(siteId, deviceCategory));
|
List<EmsPointMatch> pointMatchList = redisCache.getCacheList(getPointMacthCacheKey(siteId, deviceId, deviceCategory));
|
||||||
if (CollectionUtils.isEmpty(pointMatchList)) {
|
if (CollectionUtils.isEmpty(pointMatchList)) {
|
||||||
pointMatchList = emsPointMatchMapper.getDevicePointMatchList(siteId, deviceCategory);
|
pointMatchList = emsPointMatchMapper.getDevicePointMatchList(siteId, deviceId, deviceCategory);
|
||||||
}
|
}
|
||||||
if (CollectionUtils.isNotEmpty(pointMatchList)) {
|
if (CollectionUtils.isNotEmpty(pointMatchList)) {
|
||||||
Map<Integer, List<EmsPointMatch>> map = pointMatchList.stream().collect(Collectors.groupingBy(EmsPointMatch::getIsAlarm));
|
Map<Integer, List<EmsPointMatch>> map = pointMatchList.stream().collect(Collectors.groupingBy(EmsPointMatch::getIsAlarm));
|
||||||
@ -154,7 +154,7 @@ public class DevicePointMatchDataProcessor {
|
|||||||
try {
|
try {
|
||||||
devicePintointMtachInfo.forEach((key, value) -> {
|
devicePintointMtachInfo.forEach((key, value) -> {
|
||||||
// 查询点位是否存在
|
// 查询点位是否存在
|
||||||
EmsPointMatch dbPoint = emsPointMatchMapper.getOnePointMatch(siteId, deviceCategory, value);
|
EmsPointMatch dbPoint = emsPointMatchMapper.getOnePointMatch(siteId, deviceId, deviceCategory, value);
|
||||||
if (!Objects.isNull(dbPoint)) {
|
if (!Objects.isNull(dbPoint)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -214,9 +214,9 @@ public class DevicePointMatchDataProcessor {
|
|||||||
* @param deviceCategory
|
* @param deviceCategory
|
||||||
* @return 点位缓存key
|
* @return 点位缓存key
|
||||||
*/
|
*/
|
||||||
public static String getPointMacthCacheKey(String siteId, String deviceCategory)
|
public static String getPointMacthCacheKey(String siteId, String deviceId, String deviceCategory)
|
||||||
{
|
{
|
||||||
return RedisKeyConstants.POINT_MATCH + deviceCategory + "_" + siteId;
|
return RedisKeyConstants.POINT_MATCH + deviceCategory + "_" + siteId + "_" + deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -25,10 +25,11 @@
|
|||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<result property="isAlarm" column="is_alarm" />
|
<result property="isAlarm" column="is_alarm" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmsPointMatchVo">
|
<sql id="selectEmsPointMatchVo">
|
||||||
select id, point_name, match_table, match_field, site_id, device_category, data_point, data_point_name, data_device, data_unit, ip_address, ip_port, data_type, need_diff_device_id, create_by, create_time, update_by, update_time, remark, is_alarm from ems_point_match
|
select id, point_name, match_table, match_field, site_id, device_category, data_point, data_point_name, data_device, data_unit, ip_address, ip_port, data_type, need_diff_device_id, create_by, create_time, update_by, update_time, remark, is_alarm, device_id from ems_point_match
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEmsPointMatchList" parameterType="EmsPointMatch" resultMap="EmsPointMatchResult">
|
<select id="selectEmsPointMatchList" parameterType="EmsPointMatch" resultMap="EmsPointMatchResult">
|
||||||
@ -77,6 +78,7 @@
|
|||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="isAlarm != null">is_alarm,</if>
|
<if test="isAlarm != null">is_alarm,</if>
|
||||||
|
<if test="deviceId != null">device_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="pointName != null">#{pointName},</if>
|
<if test="pointName != null">#{pointName},</if>
|
||||||
@ -123,6 +125,7 @@
|
|||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="isAlarm != null">is_alarm = #{isAlarm},</if>
|
<if test="isAlarm != null">is_alarm = #{isAlarm},</if>
|
||||||
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@ -434,6 +437,9 @@
|
|||||||
<if test="isAlarm != null">
|
<if test="isAlarm != null">
|
||||||
and t.is_alarm = #{isAlarm}
|
and t.is_alarm = #{isAlarm}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="deviceId != null">
|
||||||
|
and t.device_id = #{deviceId}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getClusterDevicePoints" resultType="com.xzzn.ems.domain.vo.PointQueryResponse">
|
<select id="getClusterDevicePoints" resultType="com.xzzn.ems.domain.vo.PointQueryResponse">
|
||||||
@ -465,6 +471,9 @@
|
|||||||
<if test="isAlarm != null">
|
<if test="isAlarm != null">
|
||||||
and t.is_alarm = #{isAlarm}
|
and t.is_alarm = #{isAlarm}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="deviceId != null">
|
||||||
|
and t.device_id = #{deviceId}
|
||||||
|
</if>
|
||||||
) as tmp
|
) as tmp
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="pointName != null and pointName != ''">
|
<if test="pointName != null and pointName != ''">
|
||||||
@ -490,6 +499,7 @@
|
|||||||
<select id="getOnePointMatch" resultMap="EmsPointMatchResult">
|
<select id="getOnePointMatch" resultMap="EmsPointMatchResult">
|
||||||
<include refid="selectEmsPointMatchVo"/>
|
<include refid="selectEmsPointMatchVo"/>
|
||||||
where site_id = #{siteId}
|
where site_id = #{siteId}
|
||||||
|
and device_id = #{deviceId}
|
||||||
and device_category = #{deviceCategory}
|
and device_category = #{deviceCategory}
|
||||||
and data_point = #{dataPoint}
|
and data_point = #{dataPoint}
|
||||||
order by update_time desc
|
order by update_time desc
|
||||||
@ -499,6 +509,7 @@
|
|||||||
<select id="getDevicePointMatchList" resultMap="EmsPointMatchResult">
|
<select id="getDevicePointMatchList" resultMap="EmsPointMatchResult">
|
||||||
<include refid="selectEmsPointMatchVo"/>
|
<include refid="selectEmsPointMatchVo"/>
|
||||||
where site_id = #{siteId}
|
where site_id = #{siteId}
|
||||||
|
and device_id = #{deviceId}
|
||||||
and device_category = #{deviceCategory}
|
and device_category = #{deviceCategory}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -515,6 +526,7 @@
|
|||||||
ems_point_match
|
ems_point_match
|
||||||
<where>
|
<where>
|
||||||
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||||||
|
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||||
<if test="deviceCategory != null and deviceCategory != ''"> and device_category = #{deviceCategory}</if>
|
<if test="deviceCategory != null and deviceCategory != ''"> and device_category = #{deviceCategory}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
@ -525,6 +537,7 @@
|
|||||||
ems_point_match
|
ems_point_match
|
||||||
where is_alarm = 1
|
where is_alarm = 1
|
||||||
and site_id = #{siteId}
|
and site_id = #{siteId}
|
||||||
|
and device_id = #{deviceId}
|
||||||
and device_category = #{deviceCategory}
|
and device_category = #{deviceCategory}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user