2
0

fix: 修复更换omada参数问题

This commit is contained in:
caiyuchao
2025-01-15 17:59:23 +08:00
parent 6eaf2bf471
commit e173c62c0c
4 changed files with 42 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.constant.Constants;
import org.wfc.common.core.domain.R;
import org.wfc.common.core.exception.job.TaskException;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.poi.ExcelUtil;
@@ -23,6 +24,7 @@ import org.wfc.common.log.enums.BusinessType;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.job.domain.SysJob;
import org.wfc.job.service.ISysJobService;
import org.wfc.job.task.CdrInfoTask;
import org.wfc.job.util.CronUtils;
import org.wfc.job.util.ScheduleUtils;
@@ -41,6 +43,9 @@ public class SysJobController extends BaseController
@Autowired
private ISysJobService jobService;
@Autowired
private CdrInfoTask cdrInfoTask;
/**
* 查询定时任务列表
*/
@@ -169,6 +174,14 @@ public class SysJobController extends BaseController
@PutMapping("/run")
public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
{
SysJob sysJob = jobService.selectJobById(job.getJobId());
if (sysJob != null && sysJob.getInvokeTarget().contains("cdrInfoTask")) {
R<Boolean> omadaResult = cdrInfoTask.testOmadaApi();
if (omadaResult.getCode() != 200) {
return error(omadaResult.getMsg());
}
}
boolean result = jobService.run(job);
return result ? success() : error("任务不存在或已过期!");
}

View File

@@ -3,6 +3,7 @@ package org.wfc.job.task;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.wfc.common.core.domain.R;
import org.wfc.system.api.RemoteUserService;
import org.wfc.user.api.RemoteUUserService;
@@ -23,9 +24,13 @@ public class CdrInfoTask {
public void addCdrInfo() {
long startTime = System.currentTimeMillis();
remoteUUserService.addCdrInfoByOmadaApi();
remoteUserService.deviceJob();
remoteUUserService.addCdrInfoByOmadaApi();
long endTime = System.currentTimeMillis();
log.info("wifi定时任务执行成功, 耗时:{} 毫秒", endTime - startTime);
}
public R<Boolean> testOmadaApi() {
return remoteUserService.deviceJob();
}
}