|
|
|
@ -4,10 +4,13 @@ import com.xxl.job.admin.core.cron.CronExpression;
|
|
|
|
|
import com.xxl.job.admin.core.model.XxlJobGroup;
|
|
|
|
|
import com.xxl.job.admin.core.model.XxlJobInfo;
|
|
|
|
|
import com.xxl.job.admin.core.model.XxlJobLogReport;
|
|
|
|
|
import com.xxl.job.admin.core.model.XxlJobUser;
|
|
|
|
|
import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum;
|
|
|
|
|
import com.xxl.job.admin.core.scheduler.MisfireStrategyEnum;
|
|
|
|
|
import com.xxl.job.admin.core.scheduler.ScheduleTypeEnum;
|
|
|
|
|
import com.xxl.job.admin.core.thread.JobScheduleHelper;
|
|
|
|
|
import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
|
|
|
|
|
import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
|
|
|
|
|
import com.xxl.job.admin.core.util.I18nUtil;
|
|
|
|
|
import com.xxl.job.admin.dao.*;
|
|
|
|
|
import com.xxl.job.admin.service.XxlJobService;
|
|
|
|
@ -345,6 +348,42 @@ public class XxlJobServiceImpl implements XxlJobService {
|
|
|
|
|
return ReturnT.SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ReturnT<String> trigger(XxlJobUser loginUser, int jobId, String executorParam, String addressList) {
|
|
|
|
|
// permission
|
|
|
|
|
if (loginUser == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL.getCode(), I18nUtil.getString("system_permission_limit"));
|
|
|
|
|
}
|
|
|
|
|
XxlJobInfo xxlJobInfo = xxlJobInfoDao.loadById(jobId);
|
|
|
|
|
if (xxlJobInfo == null) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL.getCode(), I18nUtil.getString("jobinfo_glue_jobid_unvalid"));
|
|
|
|
|
}
|
|
|
|
|
if (!hasPermission(loginUser, xxlJobInfo.getJobGroup())) {
|
|
|
|
|
return new ReturnT<String>(ReturnT.FAIL.getCode(), I18nUtil.getString("system_permission_limit"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// force cover job param
|
|
|
|
|
if (executorParam == null) {
|
|
|
|
|
executorParam = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JobTriggerPoolHelper.trigger(jobId, TriggerTypeEnum.MANUAL, -1, null, executorParam, addressList);
|
|
|
|
|
return ReturnT.SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean hasPermission(XxlJobUser loginUser, int jobGroup){
|
|
|
|
|
if (loginUser.getRole() == 1) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
List<String> groupIdStrs = new ArrayList<>();
|
|
|
|
|
if (loginUser.getPermission()!=null && loginUser.getPermission().trim().length()>0) {
|
|
|
|
|
groupIdStrs = Arrays.asList(loginUser.getPermission().trim().split(","));
|
|
|
|
|
}
|
|
|
|
|
return groupIdStrs.contains(String.valueOf(jobGroup));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> dashboardInfo() {
|
|
|
|
|
|
|
|
|
|