1.增加测试自助平台连通性接口

master
x_z 2 years ago
parent 838d5bdf54
commit 2a5ccbabcf

@ -156,7 +156,7 @@ public class PlatformController {
if (StrUtil.isBlank(platformId)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return platformService.getTargetActions(platformId,invSubCode);
return platformService.getTargetActions(platformId, invSubCode);
}
@ -179,4 +179,19 @@ public class PlatformController {
return platformService.getTargetSubInv(platformId, invCode);
}
/**
*
*
* @param host
* @return
*/
@AuthRuleAnnotation("")
@GetMapping("udims/platform/testPlatformConnection")
public BaseResponse testPlatformConnection(String host) {
if (StrUtil.isBlank(host)) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
return platformService.testPlatformConnection(host);
}
}

@ -1,5 +1,6 @@
package com.glxp.udi.admin.entity.info;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -7,6 +8,7 @@ import lombok.Data;
@TableName("auth_platform")
public class PlatformEntity {
@TableId
private String id;
private String name; //平台名称

@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.udi.admin.common.enums.ResultEnum;
import com.glxp.udi.admin.common.res.BaseResponse;
import com.glxp.udi.admin.dao.info.PlatformDao;
import com.glxp.udi.admin.dao.inout.UnitMaintainDao;
@ -182,4 +184,28 @@ public class PlatformService {
return ResultVOUtils.error(500, "获取自助平台接口异常");
}
}
/**
*
*
* @param host
* @return
*/
public BaseResponse testPlatformConnection(String host) {
String testUrl = host + "/udiwms/auth/device/connect";
String response = HttpUtil.get(testUrl);
if (StrUtil.isNotBlank(response)) {
try {
BaseResponse result = JSONUtil.toBean(response, BaseResponse.class);
if (result.getCode() == 20000) {
return ResultVOUtils.success();
}
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
} catch (Exception e) {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
} else {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
}
}

Loading…
Cancel
Save