delete maxkey-synchronizer-reorgdept & settings.gradle文件优化
This commit is contained in:
@@ -22,9 +22,11 @@ import org.dromara.maxkey.configuration.ApplicationConfig;
|
||||
import org.dromara.maxkey.listener.DynamicGroupsListenerAdapter;
|
||||
import org.dromara.maxkey.listener.ListenerAdapter;
|
||||
import org.dromara.maxkey.listener.ListenerParameter;
|
||||
import org.dromara.maxkey.listener.ReorgDeptListenerAdapter;
|
||||
import org.dromara.maxkey.listener.SessionListenerAdapter;
|
||||
import org.dromara.maxkey.persistence.service.ConnectorsService;
|
||||
import org.dromara.maxkey.persistence.service.GroupsService;
|
||||
import org.dromara.maxkey.persistence.service.OrganizationsService;
|
||||
import org.dromara.maxkey.provision.thread.ProvisioningRunner;
|
||||
import org.dromara.maxkey.provision.thread.ProvisioningRunnerThread;
|
||||
import org.quartz.Scheduler;
|
||||
@@ -55,6 +57,20 @@ public class MaxKeyMgtListenerConfig {
|
||||
return "sessionListenerAdapter";
|
||||
}
|
||||
|
||||
@Bean
|
||||
public String reorgDeptListenerAdapter(
|
||||
Scheduler scheduler,
|
||||
OrganizationsService organizationsService) throws SchedulerException {
|
||||
ListenerAdapter.addListener(
|
||||
scheduler,
|
||||
ReorgDeptListenerAdapter.class,
|
||||
"0 0/30 * * * ?",//30 minutes
|
||||
new ListenerParameter().add("organizationsService",organizationsService).build()
|
||||
);
|
||||
logger.debug("ReorgDept ListenerAdapter inited .");
|
||||
return "reorgDeptListenerAdapter";
|
||||
}
|
||||
|
||||
@Bean
|
||||
public String dynamicGroupsListenerAdapter(
|
||||
Scheduler scheduler,
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright [2024] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.dromara.maxkey.listener;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.dromara.maxkey.persistence.service.OrganizationsService;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class ReorgDeptListenerAdapter extends ListenerAdapter implements Job , Serializable {
|
||||
static final Logger _logger = LoggerFactory.getLogger(ReorgDeptListenerAdapter.class);
|
||||
|
||||
private static final long serialVersionUID = 4782358765969474833L;
|
||||
|
||||
transient OrganizationsService organizationsService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
if(jobStatus == JOBSTATUS.RUNNING) {return;}
|
||||
init(context);
|
||||
|
||||
_logger.debug("running ... " );
|
||||
jobStatus = JOBSTATUS.RUNNING;
|
||||
try {
|
||||
organizationsService.reorgNamePath(null);
|
||||
_logger.debug("finished " );
|
||||
jobStatus = JOBSTATUS.FINISHED;
|
||||
}catch(Exception e) {
|
||||
jobStatus = JOBSTATUS.ERROR;
|
||||
_logger.error("Exception " ,e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(JobExecutionContext context){
|
||||
super.init(context);
|
||||
if(organizationsService == null) {
|
||||
organizationsService = getParameter("organizationsService",OrganizationsService.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class SessionListenerAdapter extends ListenerAdapter implements Job , S
|
||||
for (HistoryLogin login : sessionManager.querySessions()) {
|
||||
Session session = sessionManager.get(login.getSessionId());
|
||||
if(session == null) {
|
||||
logger.debug("user {} session {} Login at {} and TimeOut at {} ." ,
|
||||
logger.debug("TimeOut user {} session {} Login at {} and at {} ." ,
|
||||
login.getUsername(),
|
||||
login.getId(),
|
||||
login.getLoginTime(),
|
||||
|
||||
Reference in New Issue
Block a user