mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-07 01:18:27 +08:00
Update InstitutionsServiceImpl.java
This commit is contained in:
parent
7fa0d6ba55
commit
1559164891
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.dromara.maxkey.persistence.service.impl;
|
package org.dromara.maxkey.persistence.service.impl;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.dromara.maxkey.entity.Institutions;
|
import org.dromara.maxkey.entity.Institutions;
|
||||||
@ -43,10 +42,6 @@ public class InstitutionsServiceImpl extends JpaServiceImpl<InstitutionsMapper,
|
|||||||
.expireAfterWrite(60, TimeUnit.MINUTES)
|
.expireAfterWrite(60, TimeUnit.MINUTES)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
//id domain mapping
|
|
||||||
protected static final ConcurrentHashMap<String,String> mapper = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
public Institutions findByDomain(String domain) {
|
public Institutions findByDomain(String domain) {
|
||||||
return getMapper().findByDomain(domain);
|
return getMapper().findByDomain(domain);
|
||||||
}
|
}
|
||||||
@ -63,14 +58,14 @@ public class InstitutionsServiceImpl extends JpaServiceImpl<InstitutionsMapper,
|
|||||||
|
|
||||||
private Institutions getByDomain(String instIdOrDomain) {
|
private Institutions getByDomain(String instIdOrDomain) {
|
||||||
_logger.trace(" instId {}" , instIdOrDomain);
|
_logger.trace(" instId {}" , instIdOrDomain);
|
||||||
Institutions inst = institutionsStore.getIfPresent(mapper.get(instIdOrDomain)==null ? DEFAULT_INSTID : mapper.get(instIdOrDomain) );
|
Institutions inst = institutionsStore.getIfPresent(instIdOrDomain);
|
||||||
if(inst == null) {
|
if(inst == null) {
|
||||||
Institutions institution = findByDomain(instIdOrDomain);
|
Institutions institution = findByDomain(instIdOrDomain);
|
||||||
if(institution != null ) {
|
if(institution != null ) {
|
||||||
inst = institution;
|
inst = institution;
|
||||||
institutionsStore.put(inst.getDomain(), inst);
|
institutionsStore.put(inst.getDomain(), inst);
|
||||||
institutionsStore.put(inst.getConsoleDomain(), inst);
|
institutionsStore.put(inst.getConsoleDomain(), inst);
|
||||||
mapper.put(inst.getId(), inst.getDomain());
|
institutionsStore.put(inst.getId(), inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user