fix(接口自动化): 接口自动化多节点执行问题调整

This commit is contained in:
fit2-zhao 2021-04-19 09:53:52 +08:00 committed by fit2-zhao
parent 78f15b801c
commit fbdb707d7a
2 changed files with 3 additions and 2 deletions

View File

@ -31,8 +31,9 @@ import java.util.Map;
@Service
public class MsKafkaListener {
public static final String TOPICS = "ms-api-exec-topic";
public static final String CONSUME_ID = "ms-api-exec-consume";
@KafkaListener(topics = TOPICS)
@KafkaListener(id = CONSUME_ID, topics = TOPICS, groupId = "${spring.kafka.consumer.group-id}")
public void consume(ConsumerRecord<?, String> record) {
LogUtil.info("接收到执行结果开始存储");
this.save(record.value());

View File

@ -55,7 +55,7 @@ public class ApiDefinitionExecResultService {
ApiDefinitionExecResult saveResult = new ApiDefinitionExecResult();
saveResult.setId(UUID.randomUUID().toString());
saveResult.setCreateTime(item.getStartTime());
saveResult.setUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
saveResult.setUserId(result.getUserId());
saveResult.setName(item.getName());
if (item.getName().indexOf("<->") != -1) {
saveResult.setName(item.getName().substring(0, item.getName().indexOf("<->")));