fix: 修复omada上云问题
This commit is contained in:
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.PutMapping;
|
||||
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.domain.R;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.domain.AjaxResult;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
@@ -80,4 +81,9 @@ public class SysDeviceController extends BaseController {
|
||||
public AjaxResult settingJob() {
|
||||
return toAjax(sysDeviceService.settingJob());
|
||||
}
|
||||
|
||||
@PostMapping("/testJob")
|
||||
public R<String> testJob() {
|
||||
return R.ok(sysDeviceService.testJob());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,4 +16,6 @@ public interface ISysDeviceService extends IService<SysDevice> {
|
||||
boolean deviceJob();
|
||||
|
||||
boolean settingJob();
|
||||
|
||||
String testJob();
|
||||
}
|
||||
|
||||
@@ -53,8 +53,10 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
||||
private static final String REDIS_ACCESS_TOKEN = "wfc-api-omada:access-token";
|
||||
private static final String REDIS_REFRESH_TOKEN = "wfc-api-omada:refresh-token";
|
||||
private static final int OMADA_ERROR_CODE = -44112;
|
||||
private static final int OMADA_SUCCESS_CODE = 0;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean deviceJob() {
|
||||
ResponseEntity<OperationResponseGridVoSiteSummaryInfo> siteList = omadaSiteApi.getSiteList(1, 1000);
|
||||
if (siteList.getBody() == null) {
|
||||
@@ -92,6 +94,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean settingJob() {
|
||||
// 启用Omada历史记录保留
|
||||
ResponseEntity<OperationResponseHistoryRetentionOpenApiVo> dataRetentionRes = omadaHistoryDataRetentionApi.getDataRetention();
|
||||
@@ -115,4 +118,12 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String testJob() {
|
||||
ResponseEntity<OperationResponseGridVoSiteSummaryInfo> siteList = omadaSiteApi.getSiteList(1, 1000);
|
||||
if (siteList.getBody() != null && siteList.getBody().getErrorCode() == OMADA_SUCCESS_CODE) {
|
||||
return "success";
|
||||
}
|
||||
return siteList.getBody().getMsg();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user