This commit is contained in:
tanghc
2019-07-26 17:36:09 +08:00
parent d42c9e9ba4
commit fdf9f341fd
50 changed files with 262 additions and 46 deletions

View File

@@ -14,7 +14,6 @@ import com.gitee.sop.adminserver.api.service.param.ConfigIpBlackForm;
import com.gitee.sop.adminserver.api.service.param.ConfigIpBlacklistPageParam;
import com.gitee.sop.adminserver.api.service.result.ConfigIpBlacklistVO;
import com.gitee.sop.adminserver.bean.ChannelMsg;
import com.gitee.sop.adminserver.bean.ConfigLimitDto;
import com.gitee.sop.adminserver.bean.ZookeeperContext;
import com.gitee.sop.adminserver.common.BizException;
import com.gitee.sop.adminserver.entity.ConfigIpBlacklist;
@@ -93,6 +92,13 @@ public class IPBlacklistApi {
}
enum BlacklistMsgType {
ADD, DELETE
/**
* 黑名单消息类型:添加
*/
ADD,
/**
* 黑名单消息类型:删除
*/
DELETE
}
}

View File

@@ -40,6 +40,7 @@ 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";
@Autowired
ConfigCommonMapper configCommonMapper;
@@ -135,7 +136,7 @@ public class LogApi {
try {
String json = this.requestLogServer(ipPort, "listErrors");
JSONObject jsonObject = JSON.parseObject(json);
if (!CODE_SUCCESS.equals(jsonObject.getString("code"))) {
if (!CODE_SUCCESS.equals(jsonObject.getString(CODE_KEY))) {
log.error("请求结果:{}", json);
throw new BizException("添加失败");
}
@@ -147,7 +148,7 @@ public class LogApi {
private String requestLogServer(String ipPort, String path) throws Exception {
DefaultMd5Verifier md5Verifier = new DefaultMd5Verifier();
Map<String, Object> params = new HashMap<>();
Map<String, Object> params = new HashMap<>(16);
params.put("time", System.currentTimeMillis());
String sign = md5Verifier.buildSign(params, secret);
params.put("sign", sign);

View File

@@ -115,7 +115,7 @@ public class ServiceApi {
List<ServiceInstanceVO> listService(ServiceSearchParam param) {
List<ServiceInfo> serviceInfos;
try {
serviceInfos = registryService.listAllService(1, 99999/* 获取所有实例 */);
serviceInfos = registryService.listAllService(1, 99999);
} catch (Exception e) {
log.error("获取服务实例失败", e);
return Collections.emptyList();

View File

@@ -9,7 +9,7 @@ import lombok.Data;
public class LogMonitorInstanceVO {
private String id;
private int treeId;
// 表主键
/** 表主键 */
private long rawId;
private String name;
private String version;

View File

@@ -22,6 +22,7 @@ import org.springframework.util.Assert;
import java.io.Closeable;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Executors;
import static com.gitee.sop.adminserver.bean.SopAdminConstants.SOP_MSG_CHANNEL_PATH;
@@ -307,7 +308,7 @@ public class ZookeeperContext {
String data = new String(nodeData);
if (StringUtils.isNotBlank(data) && !initData.equals(data)) {
listenCallback.onError(data);
new Thread(new ZKClose(cache, client)).start();
Executors.newSingleThreadExecutor().execute(() -> new ZKClose(cache, client));
}
}
});

View File

@@ -9,7 +9,8 @@ import com.gitee.easyopen.message.ErrorMeta;
public class AdminErrors {
private AdminErrors(){}
static String isvModule = "isv.error_"; // error_zh_CN2.properties内容前缀
/** error_zh_CN2.properties内容前缀 */
static String isvModule = "isv.error_";
public static final ErrorMeta NO_LOGIN = new ErrorMeta(isvModule, "-100", "用户未登录");

View File

@@ -124,9 +124,9 @@ public class IdGen {
lastTimestamp = timestamp;
//移位并通过或运算拼到一起组成64位的ID
return ((timestamp - twepoch) << timestampLeftShift) //
| (datacenterId << datacenterIdShift) //
| (workerId << workerIdShift) //
return ((timestamp - twepoch) << timestampLeftShift)
| (datacenterId << datacenterIdShift)
| (workerId << workerIdShift)
| sequence;
}

View File

@@ -309,7 +309,14 @@ public class RSATool {
}
public enum KeyLength {
LENGTH_1024(1024), LENGTH_2048(2048);
/**
* 秘钥长度1024
*/
LENGTH_1024(1024),
/**
* 秘钥长度2048
*/
LENGTH_2048(2048);
private int length;
KeyLength(int length) {

View File

@@ -28,7 +28,7 @@ public class IsvInfo {
/** appKey, 数据库字段app_key */
private String appKey;
// 不再使用转移到isv_keys表
/** 不再使用转移到isv_keys表 */
private String secret = "";
/** 公钥,不再使用转移到isv_keys表 数据库字段pub_key */

View File

@@ -15,6 +15,8 @@ import javax.servlet.http.HttpServletResponse;
*/
public class LoginInterceptor extends ApiInterceptorAdapter {
public static final String PREFIX = "nologin.";
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object serviceObj, Object argu)
throws Exception {
@@ -28,7 +30,8 @@ public class LoginInterceptor extends ApiInterceptorAdapter {
@Override
public boolean match(ApiMeta apiMeta) {
String name = apiMeta.getName();
if (name.startsWith("nologin.")) { // 以nologin.’开头的接口不拦截
// 以nologin.’开头的接口不拦截
if (name.startsWith(PREFIX)) {
return false;
} else {
return true;

View File

@@ -13,6 +13,11 @@ import org.apache.ibatis.annotations.Select;
*/
public interface IsvInfoMapper extends CrudMapper<IsvInfo, Long> {
/**
* 获取isv详细信息
* @param appKey appKey
* @return 返回详细信息没有返回null
*/
@Select("SELECT " +
" t.app_key appKey " +
" ,t.status " +