mirror of
https://gitee.com/raoxy/kongx.git
synced 2025-07-23 00:00:01 +08:00
优化环境管理
This commit is contained in:
parent
ae9244d179
commit
9419ec5a3d
@ -23,6 +23,5 @@ public class HealthCheckController {
|
||||
@RequestMapping(value = "/health/check")
|
||||
public void check(HttpServletResponse response) {
|
||||
response.setStatus(200);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -15,5 +15,4 @@ public class SignInController {
|
||||
@RequestParam(value = "logout", required = false) String logout) {
|
||||
return "index.html";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.kongx.serve.controller.system;
|
||||
|
||||
import com.kongx.common.core.entity.UserInfo;
|
||||
import com.kongx.common.jsonwrapper.JsonHeaderWrapper;
|
||||
import com.kongx.serve.controller.BaseController;
|
||||
import com.kongx.serve.entity.system.OperationLog;
|
||||
import com.kongx.serve.entity.system.SystemProfile;
|
||||
import com.kongx.common.core.entity.UserInfo;
|
||||
import com.kongx.serve.service.system.SystemProfileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -64,6 +64,20 @@ public class SystemProfileController extends BaseController {
|
||||
return jsonHeaderWrapper;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/profiles/probing", method = RequestMethod.POST)
|
||||
public JsonHeaderWrapper probing(@RequestBody SystemProfile systemProfile) {
|
||||
JsonHeaderWrapper jsonHeaderWrapper = this.init();
|
||||
try {
|
||||
Map map = this.systemProfileService.probing(systemProfile);
|
||||
jsonHeaderWrapper.setData(map.get("version"));
|
||||
} catch (Exception e) {
|
||||
jsonHeaderWrapper.setErrmsg(e.getMessage());
|
||||
jsonHeaderWrapper.setStatus(JsonHeaderWrapper.StatusEnum.Failed.getCode());
|
||||
}
|
||||
return jsonHeaderWrapper;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/profiles/{clientId}", method = RequestMethod.POST)
|
||||
public JsonHeaderWrapper update(@PathVariable int clientId, @RequestBody SystemProfile systemProfile, UserInfo userInfo) {
|
||||
JsonHeaderWrapper jsonHeaderWrapper = this.init();
|
||||
|
@ -21,16 +21,14 @@ public class SystemProfile {
|
||||
|
||||
private String env;
|
||||
|
||||
private String version;
|
||||
|
||||
private String deployType;
|
||||
|
||||
private String ab;//环境缩写
|
||||
|
||||
private String url;
|
||||
|
||||
private String consul_url;
|
||||
|
||||
private String config_url;
|
||||
|
||||
private String extensions = "[]";//扩展配置
|
||||
|
||||
private String creator;
|
||||
|
@ -14,15 +14,14 @@ public interface SystemProfileMapper {
|
||||
})
|
||||
List<SystemProfile> findAll();
|
||||
|
||||
@Insert({"insert into kongx_system_profile(profile_code,name,env,deploy_type,ab,url, consul_url,config_url,extensions,profile, creator, create_at) " +
|
||||
"values(#{profileCode},#{name},#{env},#{deployType},#{ab}, #{url},#{consul_url},#{config_url},#{extensions}, #{profile}, #{creator}, #{create_at, jdbcType=TIMESTAMP})"})
|
||||
@Insert({"insert into kongx_system_profile(profile_code,name,env,deploy_type,ab,url,version, extensions,profile, creator, create_at) " +
|
||||
"values(#{profileCode},#{name},#{env},#{deployType},#{ab}, #{url},#{version},#{extensions}, #{profile}, #{creator}, #{create_at, jdbcType=TIMESTAMP})"})
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
int add(SystemProfile systemProfile);
|
||||
|
||||
@Update({"update kongx_system_profile set ",
|
||||
"profile_code=#{client.profileCode},name=#{client.name},ab=#{client.ab},url=#{client.url},",
|
||||
"env=#{client.env},deploy_type=#{client.deployType},",
|
||||
"consul_url=#{client.consul_url},config_url=#{client.config_url},",
|
||||
"env=#{client.env},deploy_type=#{client.deployType},version=#{client.version},",
|
||||
"extensions=#{client.extensions},profile=#{client.profile} where id=#{client.id}"})
|
||||
int update(@Param("client") SystemProfile client);
|
||||
|
||||
|
@ -37,4 +37,6 @@ public class KongInfoService extends AbstractService {
|
||||
public Map status(SystemProfile systemProfile) throws URISyntaxException {
|
||||
return kongInfoFeignService.status(uri(systemProfile, STATUS_URI));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -62,8 +62,8 @@ public class EnvService {
|
||||
values.forEach((profile) -> {
|
||||
Map map = new HashMap<>();
|
||||
map.put("label", profile.get("code"));
|
||||
map.put("value", profile.get("profile"));
|
||||
map.put("profile", deployType + "" + profile.get("profile"));
|
||||
map.put("value", deployType + "" + profile.get("profile"));
|
||||
map.put("profileCode", profile.get("code"));
|
||||
results.add(map);
|
||||
});
|
||||
|
@ -1,9 +1,11 @@
|
||||
package com.kongx.serve.service.system;
|
||||
|
||||
import com.kongx.serve.entity.system.SystemProfile;
|
||||
import com.kongx.serve.mapper.SystemProfileMapper;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.kongx.serve.entity.system.SystemProfile;
|
||||
import com.kongx.serve.mapper.SystemProfileMapper;
|
||||
import com.kongx.serve.service.AbstractService;
|
||||
import com.kongx.serve.service.gateway.KongInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -13,7 +15,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("SystemProfileService")
|
||||
public class SystemProfileService {
|
||||
public class SystemProfileService extends AbstractService {
|
||||
|
||||
@Autowired
|
||||
private SystemProfileMapper systemProfileMapper;
|
||||
@ -21,6 +23,13 @@ public class SystemProfileService {
|
||||
@Autowired
|
||||
private EnvService envService;
|
||||
|
||||
@Autowired
|
||||
private KongInfoService kongInfoService;
|
||||
|
||||
public Map probing(SystemProfile systemProfile) throws Exception {
|
||||
return this.kongInfoService.info(systemProfile);
|
||||
}
|
||||
|
||||
protected Cache<String, SystemProfile> KONG_CLIENT_CACHE = CacheBuilder.newBuilder()
|
||||
.maximumSize(1000)
|
||||
.build();
|
||||
|
@ -9,7 +9,7 @@ spring:
|
||||
server:
|
||||
port: 8095
|
||||
servlet:
|
||||
context-path: /
|
||||
context-path: /kongx
|
||||
mybatis:
|
||||
configuration:
|
||||
default-fetch-size: 100
|
||||
|
Loading…
x
Reference in New Issue
Block a user