mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
Record editting topic
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.xiaojukeji.kafka.manager.service.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xiaojukeji.kafka.manager.common.bizenum.KafkaClientEnum;
|
||||
import com.xiaojukeji.kafka.manager.common.bizenum.ModuleEnum;
|
||||
import com.xiaojukeji.kafka.manager.common.bizenum.OperateEnum;
|
||||
import com.xiaojukeji.kafka.manager.common.bizenum.TopicAuthorityEnum;
|
||||
import com.xiaojukeji.kafka.manager.common.constant.KafkaConstant;
|
||||
import com.xiaojukeji.kafka.manager.common.constant.KafkaMetricsCollections;
|
||||
@@ -81,6 +84,9 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
||||
@Autowired
|
||||
private RegionService regionService;
|
||||
|
||||
@Autowired
|
||||
private OperateRecordService operateRecordService;
|
||||
|
||||
@Override
|
||||
public List<TopicDO> listAll() {
|
||||
try {
|
||||
@@ -341,6 +347,12 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
||||
if (ValidateUtils.isNull(topicDO)) {
|
||||
return ResultStatus.TOPIC_NOT_EXIST;
|
||||
}
|
||||
|
||||
Map<String, Object> content = new HashMap<>(2);
|
||||
content.put("clusterId", clusterId);
|
||||
content.put("topicName", topicName);
|
||||
recordOperation(content, topicName, operator);
|
||||
|
||||
topicDO.setDescription(description);
|
||||
if (topicDao.updateByName(topicDO) > 0) {
|
||||
return ResultStatus.SUCCESS;
|
||||
@@ -364,6 +376,12 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
||||
return ResultStatus.APP_NOT_EXIST;
|
||||
}
|
||||
|
||||
Map<String, Object> content = new HashMap<>(4);
|
||||
content.put("clusterId", clusterId);
|
||||
content.put("topicName", topicName);
|
||||
content.put("appId", appId);
|
||||
recordOperation(content, topicName, operator);
|
||||
|
||||
TopicDO topicDO = topicDao.getByTopicName(clusterId, topicName);
|
||||
if (ValidateUtils.isNull(topicDO)) {
|
||||
// 不存在, 则需要插入
|
||||
@@ -394,6 +412,16 @@ public class TopicManagerServiceImpl implements TopicManagerService {
|
||||
return ResultStatus.MYSQL_ERROR;
|
||||
}
|
||||
|
||||
private void recordOperation(Map<String, Object> content, String topicName, String operator) {
|
||||
OperateRecordDO operateRecordDO = new OperateRecordDO();
|
||||
operateRecordDO.setModuleId(ModuleEnum.TOPIC.getCode());
|
||||
operateRecordDO.setOperateId(OperateEnum.EDIT.getCode());
|
||||
operateRecordDO.setResource(topicName);
|
||||
operateRecordDO.setContent(JSONObject.toJSONString(content));
|
||||
operateRecordDO.setOperator(operator);
|
||||
operateRecordService.insert(operateRecordDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByTopicName(Long clusterId, String topicName) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user