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
