mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
网关二合一
This commit is contained in:
@@ -41,13 +41,15 @@ public class LogApi {
|
||||
public static final String LOG_MONITOR_INSTANCE = "log.monitor.instance";
|
||||
public static final String CODE_SUCCESS = "10000";
|
||||
private static final String CODE_KEY = "code";
|
||||
public static final String SOP_LIST_ERRORS_PATH = "/sop/listErrors";
|
||||
public static final String SOP_CLEAR_ERRORS_PATH = "/sop/clearErrors";
|
||||
|
||||
@Autowired
|
||||
ConfigCommonMapper configCommonMapper;
|
||||
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
|
||||
@Value("${zuul.secret}")
|
||||
@Value("${sop.secret}")
|
||||
private String secret;
|
||||
|
||||
@Api(name = "monitor.log.list")
|
||||
@@ -66,7 +68,7 @@ public class LogApi {
|
||||
logMonitorInstanceVOParent.setMonitorName(configCommon.getContent());
|
||||
ret.add(logMonitorInstanceVOParent);
|
||||
try {
|
||||
String logData = this.requestLogServer(ipPort, "listErrors");
|
||||
String logData = this.requestLogServer(ipPort, SOP_LIST_ERRORS_PATH);
|
||||
JSONObject jsonObject = JSON.parseObject(logData);
|
||||
if (CODE_SUCCESS.equals(jsonObject.getString("code"))) {
|
||||
int errorTotal = 0;
|
||||
@@ -97,7 +99,7 @@ public class LogApi {
|
||||
}
|
||||
try {
|
||||
String ipPort = configCommon.getConfigKey();
|
||||
this.requestLogServer(ipPort, "clearErrors");
|
||||
this.requestLogServer(ipPort, SOP_CLEAR_ERRORS_PATH);
|
||||
} catch (Exception e) {
|
||||
throw new BizException("清除失败");
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ import java.util.stream.Stream;
|
||||
@Service
|
||||
public class ConfigPushService {
|
||||
|
||||
private static final String GATEWAY_PUSH_URL = "http://%s/configChannelMsg";
|
||||
private static final String GATEWAY_PUSH_URL = "http://%s/sop/configChannelMsg";
|
||||
private static final String API_GATEWAY_SERVICE_ID = "sop-gateway";
|
||||
|
||||
private static HttpTool httpTool = new HttpTool();
|
||||
@@ -40,7 +40,7 @@ public class ConfigPushService {
|
||||
@Value("${gateway.host:}")
|
||||
private String gatewayHost;
|
||||
|
||||
@Value("${zuul.secret}")
|
||||
@Value("${sop.secret}")
|
||||
private String secret;
|
||||
|
||||
public void publishConfig(String dataId, String groupId, ChannelMsg channelMsg) {
|
||||
@@ -59,6 +59,11 @@ public class ConfigPushService {
|
||||
private void pushByHost(Collection<String> hosts, GatewayPushDTO gatewayPushDTO) {
|
||||
for (String host : hosts) {
|
||||
String url = String.format(GATEWAY_PUSH_URL, host);
|
||||
log.info("推送配置, dataId={}, groupId={}, operation={}, url={}",
|
||||
gatewayPushDTO.getDataId()
|
||||
, gatewayPushDTO.getGroupId()
|
||||
, gatewayPushDTO.getChannelMsg().getOperation()
|
||||
, url);
|
||||
try {
|
||||
String requestBody = JSON.toJSONString(gatewayPushDTO);
|
||||
Map<String, String> header = new HashMap<>(8);
|
||||
|
@@ -38,4 +38,4 @@ mybatis.fill.com.gitee.fastmybatis.core.support.DateFillInsert=gmt_create
|
||||
mybatis.fill.com.gitee.fastmybatis.core.support.DateFillUpdate=gmt_modified
|
||||
|
||||
# 不用改,如果要改,请全局替换修改
|
||||
zuul.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC
|
||||
sop.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC
|
||||
|
Reference in New Issue
Block a user