class ConsumerGroupTopicServiceImpl extends AbstractBaseService<ConsumerGroupTopicEntity> implements CacheUpdateService, ConsumerGroupTopicService, TimerService {

	@Override
	public ConsumerGroupTopicEntity createConsumerGroupTopic(
			ConsumerGroupTopicCreateRequest consumerGroupTopicCreateRequest) {
		ConsumerGroupTopicEntity consumerGroupTopicEntity = new ConsumerGroupTopicEntity();
		consumerGroupTopicEntity.setConsumerGroupId(consumerGroupTopicCreateRequest.getConsumerGroupId());
		consumerGroupTopicEntity.setConsumerGroupName(consumerGroupTopicCreateRequest.getConsumerGroupName());
		consumerGroupTopicEntity.setTopicId(consumerGroupTopicCreateRequest.getTopicId());
		consumerGroupTopicEntity.setTopicName(consumerGroupTopicCreateRequest.getTopicName());
		consumerGroupTopicEntity.setOriginTopicName(consumerGroupTopicCreateRequest.getOriginTopicName());
		consumerGroupTopicEntity.setTopicType(consumerGroupTopicCreateRequest.getTopicType());
		consumerGroupTopicEntity.setMaxPullTime(consumerGroupTopicCreateRequest.getDelayPullTime());
		consumerGroupTopicEntity.setTimeOut(consumerGroupTopicCreateRequest.getTimeOut());
		if (consumerGroupTopicCreateRequest.getRetryCount() != null) {
			consumerGroupTopicEntity.setRetryCount(consumerGroupTopicCreateRequest.getRetryCount());
		}
		if (consumerGroupTopicCreateRequest.getThreadSize() != null) {
			consumerGroupTopicEntity.setThreadSize(consumerGroupTopicCreateRequest.getThreadSize());
		}
		if (consumerGroupTopicCreateRequest.getMaxLag() != null) {
			consumerGroupTopicEntity.setMaxLag(consumerGroupTopicCreateRequest.getMaxLag());
		}
		if (StringUtils.isNotEmpty(consumerGroupTopicCreateRequest.getTag())) {
			consumerGroupTopicEntity.setTag(consumerGroupTopicCreateRequest.getTag());
		}
		if (consumerGroupTopicCreateRequest.getDelayProcessTime() != null) {
			consumerGroupTopicEntity.setDelayProcessTime(consumerGroupTopicCreateRequest.getDelayProcessTime());
		}
		if (consumerGroupTopicCreateRequest.getPullBatchSize() != null) {
			consumerGroupTopicEntity.setPullBatchSize(consumerGroupTopicCreateRequest.getPullBatchSize());
		}
		consumerGroupTopicEntity.setConsumerBatchSize(consumerGroupTopicCreateRequest.getConsumerBatchSize());
		String userId = userInfoHolder.getUserId();
		consumerGroupTopicEntity.setInsertBy(userId);
		consumerGroupTopicEntity.setAlarmEmails(consumerGroupTopicCreateRequest.getAlarmEmails());
		Map<String, ConsumerGroupTopicEntity> groupTopicMap = getGroupTopic();
		if (groupTopicMap.containsKey(consumerGroupTopicCreateRequest.getConsumerGroupName() + "_"
				+ consumerGroupTopicCreateRequest.getTopicName())) {
			uiAuditLogService.recordAudit(ConsumerGroupEntity.TABLE_NAME, consumerGroupTopicEntity.getConsumerGroupId(),
					consumerGroupTopicEntity.getConsumerGroupName() + "," + consumerGroupTopicEntity.getTopicName()
							+ ",已经存在！");
			return groupTopicMap.get(consumerGroupTopicCreateRequest.getConsumerGroupName() + "_"
					+ consumerGroupTopicCreateRequest.getTopicName());
		} else {
			insert(consumerGroupTopicEntity);
			uiAuditLogService.recordAudit(ConsumerGroupEntity.TABLE_NAME, consumerGroupTopicEntity.getConsumerGroupId(),
					"添加" + consumerGroupTopicEntity.getConsumerGroupName() + "对"
							+ consumerGroupTopicEntity.getTopicName() + "订阅."
							+ JsonUtil.toJson(consumerGroupTopicEntity));
			return consumerGroupTopicEntity;
		}

	}

}