天翼云主机控制台跳转拼接ip port

develop
yuemian 2024-09-09 16:16:08 +08:00
parent 78eed2ea22
commit 967c567d26
3 changed files with 139 additions and 9 deletions

View File

@ -41,4 +41,14 @@ CREATE TABLE `physical_server` (
`is_deleted` tinyint(1) DEFAULT NULL COMMENT '是否删除',
`display_name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '展示名称',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
) 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);

View File

@ -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 2017818
*/
@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;
/**
* TEXTSELECTICONPASSWORD
*/
@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;
}

View File

@ -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