mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-10 00:42:07 +08:00
增加Topic同步任务&Bug修复
This commit is contained in:
@@ -25,6 +25,10 @@ public enum OrderTypeEnum {
|
||||
APPLY_EXPAND_CLUSTER (05, "集群扩容", "modifyClusterOrder"),
|
||||
APPLY_REDUCE_CLUSTER (15, "集群缩容", "modifyClusterOrder"),
|
||||
|
||||
ADD_GATEWAY_CONFIG (06, "增加GateWay配置", "addGatewayConfigOrder"),
|
||||
DELETE_GATEWAY_CONFIG (16, "删除GateWay配置", "deleteGatewayConfigOrder"),
|
||||
MODIFY_GATEWAY_CONFIG (26, "修改GateWay配置", "modifyGatewayConfigOrder"),
|
||||
|
||||
;
|
||||
|
||||
private Integer code;
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 增加gateway配置
|
||||
* @author zengqiao
|
||||
* @date 2021/01/12
|
||||
*/
|
||||
public class OrderExtensionAddGatewayConfigDTO {
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "值")
|
||||
private String value;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderExtensionAddGatewayConfigDTO{" +
|
||||
"type='" + type + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public boolean legal() {
|
||||
if (ValidateUtils.isBlank(type)
|
||||
|| ValidateUtils.isBlank(name)
|
||||
|| ValidateUtils.isBlank(value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 删除gateway配置
|
||||
* @author zengqiao
|
||||
* @date 2021/01/12
|
||||
*/
|
||||
public class OrderExtensionDeleteGatewayConfigDTO {
|
||||
@ApiModelProperty(value = "配置ID")
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderExtensionDeleteGatewayConfigDTO{" +
|
||||
"id=" + id +
|
||||
'}';
|
||||
}
|
||||
|
||||
public boolean legal() {
|
||||
if (ValidateUtils.isNull(id)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 修改gateway配置
|
||||
* @author zengqiao
|
||||
* @date 2021/01/12
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class OrderExtensionModifyGatewayConfigDTO {
|
||||
@ApiModelProperty(value = "配置ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "值")
|
||||
private String value;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderExtensionModifyGatewayConfigDTO{" +
|
||||
"id=" + id +
|
||||
", type='" + type + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public boolean legal() {
|
||||
if (ValidateUtils.isNull(id)
|
||||
|| ValidateUtils.isBlank(name)
|
||||
|| ValidateUtils.isBlank(type)
|
||||
|| ValidateUtils.isBlank(value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.common.entry.detail;
|
||||
|
||||
|
||||
public class OrderDetailGatewayConfigData extends AbstractOrderDetailData {
|
||||
private Long id;
|
||||
|
||||
private String type;
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
private Long version;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Long getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(Long version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderDetailGatewayConfigData{" +
|
||||
"id=" + id +
|
||||
", type='" + type + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
", version=" + version +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.common.entry.detail;
|
||||
|
||||
/**
|
||||
* gateway config修改
|
||||
* @author zengqiao
|
||||
* @date 2021/01/13
|
||||
*/
|
||||
public class OrderDetailGatewayConfigModifyData extends AbstractOrderDetailData {
|
||||
/**
|
||||
* 旧的Gateway Config
|
||||
*/
|
||||
private OrderDetailGatewayConfigData oldGatewayConfig;
|
||||
|
||||
/**
|
||||
* 新的Gateway Config
|
||||
*/
|
||||
private OrderDetailGatewayConfigData newGatewayConfig;
|
||||
|
||||
public OrderDetailGatewayConfigData getOldGatewayConfig() {
|
||||
return oldGatewayConfig;
|
||||
}
|
||||
|
||||
public void setOldGatewayConfig(OrderDetailGatewayConfigData oldGatewayConfig) {
|
||||
this.oldGatewayConfig = oldGatewayConfig;
|
||||
}
|
||||
|
||||
public OrderDetailGatewayConfigData getNewGatewayConfig() {
|
||||
return newGatewayConfig;
|
||||
}
|
||||
|
||||
public void setNewGatewayConfig(OrderDetailGatewayConfigData newGatewayConfig) {
|
||||
this.newGatewayConfig = newGatewayConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OrderDetailGatewayConfigModifyData{" +
|
||||
"oldGatewayConfig=" + oldGatewayConfig +
|
||||
", newGatewayConfig=" + newGatewayConfig +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.order;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.account.AccountService;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ao.account.Account;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.OrderDO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class AbstractGatewayConfigOrder extends AbstractOrder {
|
||||
@Autowired
|
||||
private AccountService accountService;
|
||||
|
||||
@Override
|
||||
public ResultStatus checkAuthority(OrderDO orderDO, String username) {
|
||||
if (!accountService.isAdminOrderHandler(username)) {
|
||||
return ResultStatus.USER_WITHOUT_AUTHORITY;
|
||||
}
|
||||
return ResultStatus.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Account> getApproverList(String extensions) {
|
||||
return accountService.getAdminOrderHandlerFromCache();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.order.impl.gateway;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.detail.AbstractOrderDetailData;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.handle.OrderHandleBaseDTO;
|
||||
import com.xiaojukeji.kafka.manager.bpm.order.AbstractGatewayConfigOrder;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.OrderDO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2021/01/12
|
||||
*/
|
||||
@Component("addGatewayConfigOrder")
|
||||
public class AddGatewayConfigOrder extends AbstractGatewayConfigOrder {
|
||||
|
||||
@Override
|
||||
public Result<String> checkExtensionFieldsAndGenerateTitle(String extensions) {
|
||||
return Result.buildSuc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractOrderDetailData getOrderExtensionDetailData(String extensions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultStatus handleOrderDetail(OrderDO orderDO, OrderHandleBaseDTO baseDTO, String userName) {
|
||||
return ResultStatus.SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.order.impl.gateway;
|
||||
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.detail.AbstractOrderDetailData;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.handle.OrderHandleBaseDTO;
|
||||
import com.xiaojukeji.kafka.manager.bpm.order.AbstractGatewayConfigOrder;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.OrderDO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2021/01/12
|
||||
*/
|
||||
@Component("deleteGatewayConfigOrder")
|
||||
public class DeleteGatewayConfigOrder extends AbstractGatewayConfigOrder {
|
||||
@Override
|
||||
public Result<String> checkExtensionFieldsAndGenerateTitle(String extensions) {
|
||||
return Result.buildSuc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractOrderDetailData getOrderExtensionDetailData(String extensions) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultStatus handleOrderDetail(OrderDO orderDO, OrderHandleBaseDTO baseDTO, String userName) {
|
||||
return ResultStatus.SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.xiaojukeji.kafka.manager.bpm.order.impl.gateway;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.OrderTypeEnum;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.apply.gateway.OrderExtensionModifyGatewayConfigDTO;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.detail.AbstractOrderDetailData;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.detail.OrderDetailGatewayConfigData;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.entry.detail.OrderDetailGatewayConfigModifyData;
|
||||
import com.xiaojukeji.kafka.manager.bpm.common.handle.OrderHandleBaseDTO;
|
||||
import com.xiaojukeji.kafka.manager.bpm.order.AbstractGatewayConfigOrder;
|
||||
import com.xiaojukeji.kafka.manager.common.bizenum.gateway.GatewayConfigKeyEnum;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.Result;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.ResultStatus;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.OrderDO;
|
||||
import com.xiaojukeji.kafka.manager.common.entity.pojo.gateway.GatewayConfigDO;
|
||||
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
|
||||
import com.xiaojukeji.kafka.manager.service.service.OperateRecordService;
|
||||
import com.xiaojukeji.kafka.manager.service.service.gateway.GatewayConfigService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author zengqiao
|
||||
* @date 2021/01/12
|
||||
*/
|
||||
@Component("modifyGatewayConfigOrder")
|
||||
public class ModifyGatewayConfigOrder extends AbstractGatewayConfigOrder {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ModifyGatewayConfigOrder.class);
|
||||
|
||||
@Autowired
|
||||
private GatewayConfigService gatewayConfigService;
|
||||
|
||||
@Autowired
|
||||
private OperateRecordService operateRecordService;
|
||||
|
||||
@Override
|
||||
public Result<String> checkExtensionFieldsAndGenerateTitle(String extensions) {
|
||||
OrderExtensionModifyGatewayConfigDTO orderExtensionDTO = null;
|
||||
try {
|
||||
orderExtensionDTO = JSONObject.parseObject(extensions, OrderExtensionModifyGatewayConfigDTO.class);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("class=ModifyGatewayConfigOrder||method=checkExtensionFieldsAndGenerateTitle||params={}||errMsg={}", extensions, e.getMessage());
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
if (!orderExtensionDTO.legal()) {
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
|
||||
GatewayConfigDO gatewayConfigDO = gatewayConfigService.getById(orderExtensionDTO.getId());
|
||||
if (ValidateUtils.isNull(gatewayConfigDO)) {
|
||||
// 配置不存在
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
|
||||
GatewayConfigKeyEnum configKeyEnum = GatewayConfigKeyEnum.getByConfigType(orderExtensionDTO.getType());
|
||||
if (ValidateUtils.isNull(configKeyEnum)) {
|
||||
// 配置类型不对
|
||||
return Result.buildFrom(ResultStatus.PARAM_ILLEGAL);
|
||||
}
|
||||
|
||||
return new Result<>(OrderTypeEnum.MODIFY_GATEWAY_CONFIG.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractOrderDetailData getOrderExtensionDetailData(String extensions) {
|
||||
OrderExtensionModifyGatewayConfigDTO orderExtensionDTO = null;
|
||||
try {
|
||||
orderExtensionDTO = JSONObject.parseObject(extensions, OrderExtensionModifyGatewayConfigDTO.class);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("class=ModifyGatewayConfigOrder||method=getOrderExtensionDetailData||params={}||errMsg={}", extensions, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
// 返回的数据
|
||||
OrderDetailGatewayConfigModifyData orderDetailDTO = new OrderDetailGatewayConfigModifyData();
|
||||
|
||||
// 新的配置
|
||||
OrderDetailGatewayConfigData newGatewayConfig = new OrderDetailGatewayConfigData();
|
||||
newGatewayConfig.setId(orderExtensionDTO.getId());
|
||||
newGatewayConfig.setType(orderExtensionDTO.getType());
|
||||
newGatewayConfig.setName(orderExtensionDTO.getName());
|
||||
newGatewayConfig.setValue(orderExtensionDTO.getValue());
|
||||
orderDetailDTO.setNewGatewayConfig(newGatewayConfig);
|
||||
|
||||
GatewayConfigDO gatewayConfigDO = gatewayConfigService.getById(orderExtensionDTO.getId());
|
||||
if (ValidateUtils.isNull(gatewayConfigDO)) {
|
||||
// 旧的配置不存在
|
||||
return orderDetailDTO;
|
||||
}
|
||||
|
||||
// 旧的配置
|
||||
OrderDetailGatewayConfigData oldGatewayConfig = new OrderDetailGatewayConfigData();
|
||||
newGatewayConfig.setId(gatewayConfigDO.getId());
|
||||
newGatewayConfig.setType(gatewayConfigDO.getType());
|
||||
newGatewayConfig.setName(gatewayConfigDO.getName());
|
||||
newGatewayConfig.setValue(gatewayConfigDO.getValue());
|
||||
newGatewayConfig.setVersion(gatewayConfigDO.getVersion());
|
||||
orderDetailDTO.setOldGatewayConfig(oldGatewayConfig);
|
||||
|
||||
return orderDetailDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultStatus handleOrderDetail(OrderDO orderDO, OrderHandleBaseDTO baseDTO, String username) {
|
||||
return ResultStatus.SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user