Forráskód Böngészése

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

冷冷 7 éve
szülő
commit
e5364ad202

+ 7 - 1
pigx-config/src/main/resources/config/pigx-gateway-dev.yml

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

+ 13 - 2
pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/api/controller/AdminController.java

@@ -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();

+ 9 - 2
pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/api/service/ApiAdminService.java

@@ -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);
-
 }

+ 38 - 1
pigx-visual/pigx-tx-manager/src/main/java/com/pig4cloud/pigx/manager/api/service/impl/ApiAdminServiceImpl.java

@@ -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();