优化装置状态翻转

This commit is contained in:
hzj
2026-04-09 08:58:09 +08:00
parent 044f3c4d64
commit c31d91074d

View File

@@ -122,7 +122,8 @@ public class InfluxdbPqsCommunicateImpl implements IPqsCommunicate {
pqsCommunicate.setDevId(pqsCommunicateDto.getDevId());
pqsCommunicate.setType(pqsCommunicateDto.getType());
//如果不存数据或者状态不一样则插入数据
if(CollectionUtils.isEmpty(pqsCommunicates)|| !Objects.equals( pqsCommunicates.get(0).getType(),pqsCommunicateDto.getType())){
//可能存在掉线后最后一组数据还未入库,添加时间判断
if(CollectionUtils.isEmpty(pqsCommunicates)|| (!Objects.equals( pqsCommunicates.get(0).getType(),pqsCommunicateDto.getType())&&pqsCommunicates.get(0).getTime().isBefore(pqsCommunicate.getTime()))){
pqsCommunicateMapper.insertOne(pqsCommunicate);
}