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

	@Transactional(rollbackFor = Exception.class)
	@Override
	public ConsumerGroupTopicDeleteResponse deleteConsumerGroupTopic(long consumerGroupTopicId) {
		CacheUpdateHelper.updateCache();
		Transaction catTransactionAll = Tracer.newTransaction("ConsumerGroupTopic", "deleteConsumerGroupTopic");
		ConsumerGroupTopicDeleteResponse response=new ConsumerGroupTopicDeleteResponse();
		response.setCode("0");
		try {
			ConsumerGroupTopicEntity consumerGroupTopicEntity = consumerGroupTopicRepository
					.getById(consumerGroupTopicId);			
			if(consumerGroupTopicEntity==null){
				return new ConsumerGroupTopicDeleteResponse();
			}
			// 缓存数据
			Map<String, ConsumerGroupEntity> consumerGroupMap = consumerGroupService.getCache();
			String key = consumerGroupTopicEntity.getConsumerGroupName();
			if (roleService.getRole(userInfoHolder.getUserId(), consumerGroupMap
					.get(key).getOwnerIds()) >= UserRoleEnum.USER
					.getRoleCode()) {
				throw new RuntimeException("没有操作权限，请进行权限检查。");
			}
			ConsumerGroupEntity consumerGroupEntity=consumerGroupMap.get(key);
			//如果是广播模式，并且是原始消费者组，则对原始组下的所有镜像组取消订阅
			if(consumerGroupEntity.getMode()==2&&consumerGroupEntity.getOriginName().equals(consumerGroupEntity.getName())){
				deleteByOrigin(consumerGroupMap,consumerGroupEntity,consumerGroupTopicEntity);
			}
            doDelete(consumerGroupTopicEntity);
			catTransactionAll.setStatus(Transaction.SUCCESS);
			CacheUpdateHelper.updateCache();
		} catch (Exception e) {
			catTransactionAll.setStatus(e);
			response.setCode("1");
			response.setMsg(e.getMessage());
		} finally {
			catTransactionAll.complete();
		}		
		return response;
	}

}