mirror of
https://gitee.com/san-bing/JChargePointProtocol
synced 2026-05-05 02:19:56 +08:00
不保存pileId维度的会话
This commit is contained in:
@@ -7,35 +7,26 @@ package sanbing.jcpp.app.service.cache.session;
|
||||
import lombok.Builder;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author baigod
|
||||
*/
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@RequiredArgsConstructor
|
||||
@Builder
|
||||
public class PileSessionCacheKey implements Serializable {
|
||||
|
||||
private final UUID pileId;
|
||||
private final String pileCode;
|
||||
|
||||
public PileSessionCacheKey(UUID pileId) {
|
||||
this(pileId, null);
|
||||
}
|
||||
|
||||
public PileSessionCacheKey(String pileCode) {
|
||||
this(null, pileCode);
|
||||
this.pileCode = pileCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Optional.ofNullable(pileId).map(UUID::toString).orElse(pileCode);
|
||||
return pileCode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -108,7 +108,6 @@ public class DefaultPileProtocolService implements PileProtocolService {
|
||||
pileSession.setRemoteAddress(remoteAddress);
|
||||
pileSession.setNodeId(nodeId);
|
||||
pileSession.setNodeWebapiIpPort(nodeWebapiIpPort);
|
||||
pileSessionCache.put(new PileSessionCacheKey(pile.getId()), pileSession);
|
||||
pileSessionCache.put(new PileSessionCacheKey(pile.getPileCode()), pileSession);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user