jeesit 可以用俩种导出

jeesit 可以用俩种导出1 注解在实体类上加 ExcelField title 职务 必填 align 0 0 是导入导出 sort 20 Sourcecodere classfilebyI poweredbyFer packagecom aisino ai

package com.aisino.aisinosite.common.utils.excel.annotation;

String title(); int type() default 0; int align() default 0; int sort() default 0; String dictType() default ""; String dictName() default ""; Class 
   fieldType() default Class.class; int[] groups() default {}; int length() default 0; boolean notNull() default false; 
@RequestMapping( value = {"import"}, method = {RequestMethod.POST} ) public String importFile(MultipartFile file, RedirectAttributes redirectAttributes) { try { int successNum = 0; int failureNum = 0; ImportExcel ei = new ImportExcel(file, 1, 0); List 
  
    list = ei.getDataList(MoneyOfficialCard.class); for (MoneyOfficialCard moneyOfficialCard : list) { try { moneyOfficialCardService.save(moneyOfficialCard); ++successNum; } catch (ConstraintViolationException ex) { ex.printStackTrace(); ++failureNum; } } if(successNum>0){ redirectAttributes.addFlashAttribute("mes","导入成功"+successNum+"条公务卡"); }else{ redirectAttributes.addFlashAttribute("mes","导入失败,失败信息"); } } catch (Exception e) { e.printStackTrace(); redirectAttributes.addFlashAttribute("mes","导入模板不正确"); } return "redirect:/"; } 
  

、// 页面上加

导入

 上传文件  下载模板 
    

第二中用

package com.aisino.aisinosite.modules.utils;

/ * 解析模板返回字节数组 * @param templateDir 模板目录 * @param templateName 模板名称 * @param data 数据参数 * @throws IOException * @throws TemplateException */ public static byte[] parse(String templateDir,String templateName,Map 
   
     data) throws TemplateException, IOException{ Configuration cfg = new Configuration(); cfg.setDefaultEncoding("UTF-8"); cfg.setNumberFormat("0.00"); cfg.setDirectoryForTemplateLoading(new File(templateDir)); cfg.setObjectWrapper(new DefaultObjectWrapper()); Template template = cfg.getTemplate(templateName,"utf-8"); ByteArrayOutputStream outStream = new ByteArrayOutputStream(); Writer out = new OutputStreamWriter(outStream,"UTF-8"); template.process(data, out); return outStream.toByteArray(); } / * 自定义模板字符串解析 * @param templateStr 模板字符串 * @param data 数据 * @return 解析后的字符串 * @throws IOException * @throws TemplateException */ public static String parse(String templateStr, Map 
    
      data) throws IOException, TemplateException { Configuration cfg = new Configuration(); cfg.setNumberFormat("#."); //设置装载模板 StringTemplateLoader stringLoader = new StringTemplateLoader(); stringLoader.putTemplate("myTemplate", templateStr); cfg.setTemplateLoader(stringLoader); //加载装载的模板 Template temp = cfg.getTemplate("myTemplate", "utf-8"); Writer out = new StringWriter(); temp.process(data, out); return out.toString(); } 
     
   

}

package com.aisino.aisinosite.modules.utils;

public class DownloadFile {

public static void downloadFile(String filePath,HttpServletResponse response){ BufferedInputStream bis = null; BufferedOutputStream bos = null; try { // path是指欲下载的文件的路径。 File file = new File(filePath); // 取得文件名。 String filename = file.getName(); // 设置response的Header String downLoadName = new String(filename.getBytes("gbk"), "iso8859-1"); response.setHeader("Content-Disposition", "attachment; filename=" + downLoadName); response.addHeader("Content-Length", "" + file.length()); response.setContentType("application/octet-stream"); bis = new BufferedInputStream(new FileInputStream(filePath)); bos = new BufferedOutputStream(response.getOutputStream()); byte[] buff = new byte[2048]; int bytesRead; while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) { bos.write(buff, 0, bytesRead); } bis.close(); bos.close(); } catch (Exception e) { e.printStackTrace(); } } public static boolean deleteFile(String filePath){ boolean flag = false; File file = new File(filePath); if(file.exists()){ flag = file.delete(); } return flag; } 


- 
    
    
      2015-06-05T18:19:34Z 
     
    
      2019-05-09T09:04:19Z 
     
    
      16.00 
     
   
- 
    
     
     
   
- 
    
    
      12720 
     
    
      23256 
     
    
      32767 
     
    
      32767 
     
    
      False 
     
    
      False 
     
   
- 
   
     - 
     
   
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
   
     - 
     
     
     
     
     
     
    
      - 
      
       账户统计(按账号)  
      
     
    
      - 
    
- 
   
     - 
     
      机构名称  
     
   
- 
    
     监管户名  
   
- 
    
     监管账号  
   
- 
    
     账号别名  
   
- 
    
     所属银行  
   
- 
    
     账户余额(元)  
   
- 
    
     提现违规金额(元)  
   
- 
    
     提现违规次数  
   
- 
    
     转账违规金额(元)  
   
- 
    
     转账违规次数  
   
<#list clist as item> - 
    
     
      ${item.officeName!}  
     
     
      ${item.accountName!}  
     
     
      ${item.accountNumber!}  
     
     
      ${item.alias!}  
     
     
      ${item.accountBank!}  
     
     
      ${item.balance.balance!}  
     
     
      ${item.postalMoney!}  
     
     
      ${item.postalCount!}  
     
     
      ${item.transferMoney!}  
     
     
      ${item.transferCount!}  
     
    
    
- 
   
     - 
     
     
- 
    
     
    
      9 
     
    
      300 
     
    
      300 
     
   
 
    - 
   
     - 
     
     
       3 
      
     
       7 
      
     
       8 
      
     
   
 
   
     False 
    
   
     False 
    

、、页面


版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/215594.html原文链接:https://javaforall.net

(0)
上一篇 2026年3月18日 下午1:53
下一篇 2026年3月18日 下午1:54


相关推荐

  • 大数据认定奖补条件2022年安徽省部分地市大数据企业认定奖补条件办法政策

    大数据认定奖补条件2022年安徽省部分地市大数据企业认定奖补条件办法政策2022 年安徽省大数据企业认定奖补条件办法政策这里汇编 安徽省大数据企业认定申报时间截止 8 月 20 日 接下来我们来看一下安徽省部分地市大数据企业奖补政策细则内容 申报看作者名字 安徽省大数据企业申报奖励补贴 合肥市大数据企业奖励补贴 一 合肥市 1 鼓励经市级认定的大数据企业围绕智慧城市 区块链 人工智能 加强业务驱动 开展场景应用创新 经市级备案 运用企业自主知识产权的核心技术开发智慧城市场景应用产品 且经专家委员会评审认定研发完成并上线运营的项目 给予 20 万元一次性奖补 执行部门 市数据资源局 事后奖

    2026年3月17日
    2
  • 区块链的密码算法

    区块链的密码算法区块链系统包含了计算机科学过去几十年的成果 计算机网络 P2P 算法 数据库 分布式系统 计算机密码学等密码学是区块链系统安全性保障的基础技术 形象地称为区块链的骨骼哈希算法 哈希算法 Hash 散列 杂凑 消息摘要 音译为哈希 原意是古法语 斧子 后引申为 剁碎的肉末 哈希算法 把任意长度的输入做复杂的变换后 输出固定长度的输出 这个输出称为输入的哈希值而相应的变换方法称为哈希算法 在不引起混淆的情况下 哈希算法也称哈希函数 哈希算法的输出长度和输入长度无关 哈希这种转

    2026年3月16日
    2
  • java常量类「建议收藏」

    java常量类「建议收藏」接口实现java常量类

    2025年7月28日
    4
  • java 随机数算法_Java随机数算法原理与实现方法实例详解

    java 随机数算法_Java随机数算法原理与实现方法实例详解本文实例讲述了Java随机数算法。分享给大家供大家参考,具体如下:软件实现的算法都是伪随机算法,随机种子一般是系统时间在数论中,线性同余方程是最基本的同余方程,“线性”表示方程的未知数次数是一次,即形如:ax≡b(modn)的方程。此方程有解当且仅当b能够被a与n的最大公约数整除(记作gcd(a,n)|b)。这时,如果x0是方程的一个解,那么所有的解可以表示为:{x0+k…

    2022年7月26日
    14
  • linux 重启服务器命令[通俗易懂]

    linux 重启服务器命令[通俗易懂]Linux有如下的关机和重启命令:shutdown,reboot,halt,poweroff,那么它们有什么区别呢?shutdown-建议使用的命令shutdown是最常用也是最安全的关机和重启命令,它会在关机之前调用fsck检查磁盘,其中-h和-r是最常用的参数:-h:停止系统服务并关机-r:停止系统服务后重启下面看几个例子:shutdown-h…

    2022年10月18日
    4
  • hibernate教程_Hibernate教程

    hibernate教程_Hibernate教程hibernate 教程 RecentlyIhav Hibernateiso Sothispostis

    2026年3月18日
    1

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号