@Override
  public void channelRead0(ChannelHandlerContext ctx, String request) throws Exception {
    String config;
    if (request != null && request.startsWith("superdiamond")) {
      String[] params = request.split(",");

      List<ClientInfo> addrs = clients.get(params[1] + "$$" + params[2]);
      if (addrs == null) {
        addrs = new ArrayList<ClientInfo>();
      }
      ClientInfo clientInfo = new ClientInfo(ctx.channel().remoteAddress().toString(), new Date());
      addrs.add(clientInfo);
      clients.put(params[1] + "$$" + params[2], addrs);

      channels.put(ctx.channel().remoteAddress().toString(), ctx);

      config = configService.queryConfigs(params[1], params[2], "");
    } else {
      config = "";
    }

    sendMessage(ctx, config);
  }
 @RequestMapping("/exportAllConfig/{profile}")
 public void configDownload(
     HttpServletResponse response, Long projectId, @PathVariable("profile") String profile) {
   response.setHeader("content-disposition", "attachment;filename=cs_export.xlsx");
   response.setContentType("application/octet-stream; charset=utf-8");
   OutputStream os = null;
   try {
     List<ModuleTemplate> templates = configService.queryAllConfigsByProjectId(projectId, profile);
     os = response.getOutputStream();
     Workbook wb = ExcelUtils.exportExcelFromModuleTemplate(templates);
     // 输出Excel内容
     wb.write(os);
     os.flush();
   } catch (Exception e) {
     LOGGER.error("配置导出失败", e);
   } finally {
     try {
       os.close();
     } catch (IOException e) {
       // do nothing
     }
   }
 }