天翼云主机控制台跳转拼接ip port
parent
78eed2ea22
commit
967c567d26
|
@ -42,3 +42,13 @@ CREATE TABLE `physical_server` (
|
|||
`display_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '展示名称',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
INSERT INTO cmp.system_config
|
||||
(code, name, value, remark, category, subclass, `type`, config, gmt_create, gmt_modify, mender_id, creator_id)
|
||||
VALUES('vncProtocol', '协议', 'ws', 'VNC控制台', '系统对接', 'VNC控制台', 'TEXT', '{}', NULL, '2024-08-01 08:50:28', 1, 1);
|
||||
INSERT INTO cmp.system_config
|
||||
(code, name, value, remark, category, subclass, `type`, config, gmt_create, gmt_modify, mender_id, creator_id)
|
||||
VALUES('vncHost', '地址', '1.1.1.1', 'VNC访问IP', '系统对接', 'VNC控制台', 'TEXT', '{}', NULL, '2024-08-01 08:50:28', 1, 1);
|
||||
INSERT INTO cmp.system_config
|
||||
(code, name, value, remark, category, subclass, `type`, config, gmt_create, gmt_modify, mender_id, creator_id)
|
||||
VALUES('vncPort', '端口', '1234', 'VNC访问端口', '系统对接', 'VNC控制台', 'TEXT', '{}', NULL, '2024-08-01 08:50:28', 1, 1);
|
|
@ -0,0 +1,104 @@
|
|||
package com.bocloud.cmp.entity;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.megatron.common.utils.DateSerializer;
|
||||
import com.megatron.entity.annotations.Column;
|
||||
import com.megatron.entity.annotations.IgnoreUpdate;
|
||||
import com.megatron.entity.annotations.PK;
|
||||
import com.megatron.entity.annotations.Table;
|
||||
import com.megatron.entity.bean.Generic;
|
||||
import com.megatron.entity.meta.PKStrategy;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 系统设置的类
|
||||
*
|
||||
* @author lyy
|
||||
* @Version 1.0
|
||||
* @since 2017年8月18日
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("system_config")
|
||||
public class SystemConfig extends Generic {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@PK(value = PKStrategy.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 配置编码
|
||||
*/
|
||||
@Column("code")
|
||||
private String code;
|
||||
/**
|
||||
* 配置名称
|
||||
*/
|
||||
@Column("name")
|
||||
private String name;
|
||||
/**
|
||||
* 配置值
|
||||
*/
|
||||
@Column("value")
|
||||
private String value;
|
||||
/**
|
||||
* 配置注释
|
||||
*/
|
||||
@Column("remark")
|
||||
private String remark;
|
||||
/**
|
||||
* 配置分类
|
||||
*/
|
||||
@Column("category")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 配置子类
|
||||
*/
|
||||
@Column("subclass")
|
||||
private String subclass;
|
||||
/**
|
||||
* 配置类型(TEXT、SELECTICON、PASSWORD)
|
||||
*/
|
||||
@Column("type")
|
||||
private String type;
|
||||
/**
|
||||
* 配置json串
|
||||
*/
|
||||
@Column("config")
|
||||
private String config;
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
@Column("creator_id")
|
||||
private Long creatorId;
|
||||
/**
|
||||
* 修改人Id
|
||||
*/
|
||||
@Column("mender_id")
|
||||
private Long menderId;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column("gmt_create")
|
||||
@IgnoreUpdate
|
||||
@JsonSerialize(using = DateSerializer.class)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date gmtCreate;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Column("gmt_modify")
|
||||
@JsonSerialize(using = DateSerializer.class)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date gmtModify;
|
||||
}
|
|
@ -1,14 +1,9 @@
|
|||
package com.bocloud.cmp.internal;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.bocloud.cmp.boot.model.BocloudToken;
|
||||
import com.bocloud.cmp.entity.SystemConfig;
|
||||
import com.megatron.common.model.GeneralResult;
|
||||
import com.megatron.common.utils.Common;
|
||||
import com.megatron.common.utils.MapTools;
|
||||
|
@ -17,6 +12,12 @@ import com.megatron.framework.core.Service;
|
|||
import com.megatron.framework.http.core.HttpMethod;
|
||||
import com.megatron.framework.http.core.ServiceFactory;
|
||||
import com.megatron.framework.http.model.RemoteService;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* SOC系统配置内部访问
|
||||
|
@ -35,7 +36,7 @@ public class SmsSystemConfigService implements InitializingBean {
|
|||
private static Service service = Service.create("sms");
|
||||
private Map<String, Object> headers = new HashMap<>(4);
|
||||
|
||||
public String getByCode(String code) {
|
||||
/*public String getByCode(String code) {
|
||||
RemoteService remote = serviceFactory.build(service, "/v1/sysconfigs", HttpMethod.GET, headers,
|
||||
MapTools.simpleMap(Common.CODE, code));
|
||||
GeneralResult result = remote.invoke();
|
||||
|
@ -43,6 +44,21 @@ public class SmsSystemConfigService implements InitializingBean {
|
|||
return null;
|
||||
}
|
||||
return String.valueOf(result.getData());
|
||||
}*/
|
||||
|
||||
public String getByCode(String code) {
|
||||
RemoteService remote = serviceFactory.build(service, "/v1/configs/queryByCode", HttpMethod.GET, headers,
|
||||
MapTools.simpleMap(Common.CODE, code));
|
||||
GeneralResult result = remote.invoke();
|
||||
|
||||
if (result.isSuccess()) {
|
||||
Object data = result.getData();
|
||||
if (data != null) {
|
||||
SystemConfig config = JSON.parseObject(JSON.toJSONString(data), SystemConfig.class);
|
||||
return config.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue