提交 7f5bbe8b 编写于 作者: Z zengqiao

优化

上级 daee5716
...@@ -30,7 +30,7 @@ public class HttpUtils { ...@@ -30,7 +30,7 @@ public class HttpUtils {
private static int CONNECT_TIME_OUT = 15000; private static int CONNECT_TIME_OUT = 15000;
// 读取超时时间, 单位: ms // 读取超时时间, 单位: ms
private static int READ_TIME_OUT = 2000; private static int READ_TIME_OUT = 3000;
private static final String METHOD_GET = "GET"; private static final String METHOD_GET = "GET";
private static final String METHOD_POST = "POST"; private static final String METHOD_POST = "POST";
......
...@@ -4,6 +4,7 @@ import com.xiaojukeji.kafka.manager.common.bizenum.ConsumeHealthEnum; ...@@ -4,6 +4,7 @@ import com.xiaojukeji.kafka.manager.common.bizenum.ConsumeHealthEnum;
import com.xiaojukeji.kafka.manager.common.bizenum.OffsetLocationEnum; import com.xiaojukeji.kafka.manager.common.bizenum.OffsetLocationEnum;
import com.xiaojukeji.kafka.manager.common.constant.ApiPrefix; import com.xiaojukeji.kafka.manager.common.constant.ApiPrefix;
import com.xiaojukeji.kafka.manager.common.constant.Constant; import com.xiaojukeji.kafka.manager.common.constant.Constant;
import com.xiaojukeji.kafka.manager.common.constant.SystemCodeConstant;
import com.xiaojukeji.kafka.manager.common.entity.Result; import com.xiaojukeji.kafka.manager.common.entity.Result;
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus; import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumeDetailDTO; import com.xiaojukeji.kafka.manager.common.entity.ao.consumer.ConsumeDetailDTO;
...@@ -29,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -29,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
...@@ -56,6 +58,8 @@ public class ThirdPartConsumeController { ...@@ -56,6 +58,8 @@ public class ThirdPartConsumeController {
@Autowired @Autowired
private ThirdPartService thirdPartService; private ThirdPartService thirdPartService;
private static final List<String> WHITE_SYS_CODES_LIST = Arrays.asList(SystemCodeConstant.KAFKA_MANAGER);
@ApiOperation(value = "消费组健康", notes = "消费组是否健康") @ApiOperation(value = "消费组健康", notes = "消费组是否健康")
@RequestMapping(value = "clusters/consumer-health", method = RequestMethod.POST) @RequestMapping(value = "clusters/consumer-health", method = RequestMethod.POST)
@ResponseBody @ResponseBody
...@@ -97,18 +101,20 @@ public class ThirdPartConsumeController { ...@@ -97,18 +101,20 @@ public class ThirdPartConsumeController {
return Result.buildFrom(ResultStatus.CLUSTER_NOT_EXIST); return Result.buildFrom(ResultStatus.CLUSTER_NOT_EXIST);
} }
// 检查AppID权限 if (!WHITE_SYS_CODES_LIST.contains(dto.getSystemCode())) {
if (!appService.verifyAppIdByPassword(dto.getAppId(), dto.getPassword())) { // 检查AppID权限
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL); if (!appService.verifyAppIdByPassword(dto.getAppId(), dto.getPassword())) {
} return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
// 检查权限 }
AuthorityDO authority = // 检查权限
AuthorityDO authority =
authorityService.getAuthority(dto.getClusterId(), dto.getTopicName(), dto.getAppId()); authorityService.getAuthority(dto.getClusterId(), dto.getTopicName(), dto.getAppId());
if (ValidateUtils.isNull(authority) || (authority.getAccess() & 1) <= 0) { if (ValidateUtils.isNull(authority) || (authority.getAccess() & 1) <= 0) {
authority = authorityService.getAuthority(dto.getClusterId(), "*", dto.getAppId()); authority = authorityService.getAuthority(dto.getClusterId(), "*", dto.getAppId());
} }
if (authority == null || (authority.getAccess() & 1) <= 0) { if (authority == null || (authority.getAccess() & 1) <= 0) {
return Result.buildFrom(ResultStatus.USER_WITHOUT_AUTHORITY); return Result.buildFrom(ResultStatus.USER_WITHOUT_AUTHORITY);
}
} }
List<Result> resultList = thirdPartService.resetOffsets(clusterDO, dto); List<Result> resultList = thirdPartService.resetOffsets(clusterDO, dto);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册