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