/**
* 下载文件
* @param fileName
* @param out
*/
public static void downloadTemplate(String fileName, HttpServletResponse response) {
  try {
    fileName = URLEncoder.encode(fileName, "UTF-8");
    InputStream in = new ClassPathResource(ConstantClassField.TEMPATH + fileName).getInputStream();
    OutputStream os = response.getOutputStream();
    response.reset();
    response.setContentType("application/binary;charset=utf-8");
    response.setHeader("Content-disposition", "attachment; filename=" + fileName);
    OutputStream out = response.getOutputStream();
    int len = 0;
    byte[] buffer = new byte[1024];

    while ((len = in.read(buffer)) > 0) {
      //将缓冲区的数据输出到客户端浏览器
      out.write(buffer,0,len);
    }
    os.flush();
    in.close();
  } catch (Exception e1) {
    e1.printStackTrace();
  }
}