👽 由于外部API的改变而更新代码。

This commit is contained in:
冷冷 committed 2018-08-19 19:47:44 +08:00
1 parent 6eb1712200
commit e5364ad202
4 files changed
+67 -6

No files matched your search

@@ -53,7 +53,13 @@ spring:
- Path=/daemon/**
filters:
- StripPrefix=1
# 分布式事务管理模块
- id: pigx-tx-manager
uri: lb://pigx-tx-manager
predicates:
- Path=/tx/**
filters:
- StripPrefix=1
security:
encode:
# 前端密码密钥,必须16位
@@ -31,10 +31,10 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
*@author LCN on 2017/7/1.
*
* @author LCN on 2017/7/1.
* @author LCN
* @author lengleng
*/
@@ -52,11 +52,22 @@ public class AdminController {
}
@RequestMapping(value = "/avueOnlines", method = RequestMethod.GET)
public List<ModelInfo> avueOnlines() {
return apiModelService.onlines();
}
@RequestMapping(value = "/setting", method = RequestMethod.GET)
public TxState setting() {
return apiAdminService.getState();
}
@RequestMapping(value = "/avueSetting", method = RequestMethod.GET)
public List<Map<String, Object>> avueSetting() {
return apiAdminService.getMapState();
}
@RequestMapping(value = "/json", method = RequestMethod.GET)
public String json() {
return apiAdminService.loadNotifyJson();
@@ -23,15 +23,23 @@ import com.pig4cloud.pigx.manager.model.ModelName;
import com.pig4cloud.pigx.manager.model.TxState;
import java.util.List;
import java.util.Map;
/**
* @author LCN on 2017/11/12
* @author LCN
* @author lengleng
*/
public interface ApiAdminService {
TxState getState();
/**
* k/v 获取 值封装成map
*
* @return
*/
List<Map<String, Object>> getMapState();
String loadNotifyJson();
List<ModelName> modelList();
@@ -46,5 +54,4 @@ public interface ApiAdminService {
boolean hasCompensate();
boolean delCompensate(String path);
}
@@ -18,6 +18,7 @@
package com.pig4cloud.pigx.manager.api.service.impl;
import cn.hutool.core.util.StrUtil;
import com.lorne.core.framework.exception.ServiceException;
import com.pig4cloud.pigx.manager.api.service.ApiAdminService;
import com.pig4cloud.pigx.manager.compensate.model.TxModel;
@@ -29,11 +30,13 @@ import com.pig4cloud.pigx.manager.redis.RedisServerService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author LCN on 2017/11/12
*
* @author LCN
* @author lengleng
*/
@@ -49,6 +52,40 @@ public class ApiAdminServiceImpl implements ApiAdminService {
return eurekaService.getState();
}
/**
* k/v 获取 值封装成map
*
* @return
*/
@Override
public List<Map<String, Object>> getMapState() {
TxState txState = getState();
Map<String, Object> result = new HashMap<>(16);
result.put("Socket对外服务IP", txState.getIp());
result.put("Socket对外服务端口", txState.getPort());
result.put("最大连接数", txState.getMaxConnection());
result.put("当前连接数", txState.getNowConnection());
result.put("TxManager模块心跳间隔时间(秒)", txState.getTransactionNettyHeartTime());
result.put("TxManager模块通讯最大等待时间(秒)", txState.getCompensateMaxWaitTime());
result.put("redis服务状态", StrUtil.isBlank(loadNotifyJson()) ? "异常" : "正常");
result.put("redis存储最大时间(秒)", txState.getRedisSaveMaxTime());
result.put("负载均衡服务器地址", txState.getSlbList());
result.put("存在补偿数据", hasCompensate() ? "存在" : "不存在");
result.put("补偿回调地址", txState.getNotifyUrl());
result.put("自动补偿", txState.isCompensate());
result.put("补偿尝试时间", txState.getCompensateTryTime());
result.put("自动补偿间隔时间", txState.getCompensateMaxWaitTime());
List<Map<String, Object>> resultList = new ArrayList<>();
result.forEach((k, v) -> {
Map<String, Object> one = new HashMap<>(2);
one.put("key", k);
one.put("value", v);
resultList.add(one);
});
return resultList;
}
@Override
public String loadNotifyJson() {
return redisServerService.loadNotifyJson();