http://mopishv0.blog.163.com/blog/static/5445593220101016102129741/

  1. private List<String> uploadNoticeOtherFile(HttpServletRequest request,
  2. MultipartFile[] noticeOtherFiles, User user,
  3. ServletContext servletContext) {
  4. List<String> fileList = new ArrayList<String>();
  5. if(noticeOtherFiles != null && noticeOtherFiles.length > 0 && noticeOtherFiles[0].getSize() > 0){
  6. List<FileEntity> fileEntityList = null;
  7. try {
  8. //文件去空
  9. List<MultipartFile> noticeOtherFileList = new ArrayList<MultipartFile>();
  10. for (int i = noticeOtherFiles.length; i > 0; i--) {
  11. MultipartFile noticeOtherFile = noticeOtherFiles[i];
  12. if(noticeOtherFile != null && !noticeOtherFile.isEmpty() && noticeOtherFile.getSize() > 0 && !StringUtils.isBlank(noticeOtherFile.getName())){
  13. noticeOtherFileList.add(noticeOtherFile);
  14. }
  15. }
  16.  
  17. fileEntityList = UploadFileUtils.uploadFiles(request, noticeOtherFileList.toArray(new MultipartFile[noticeOtherFileList.size()]), NoticeDictMailAttachTpl.BUSINESS_NAME, user.getId());
  18. } catch (FileUploadException e) {
  19. logger.error(e.getMessage());
  20. e.printStackTrace();
  21. }
  22. if(fileEntityList != null && fileEntityList.size() > 0){
  23. for(FileEntity fileEntity : fileEntityList)
  24. fileList.add(fileEntity.getFilePath());
  25. }
  26. }
  27. return fileList;
  28. }

关于<T> T[] toArray(T[] a) 方法的更多相关文章

  1. 集合转数组的toArray()和toArray(T[] a)方法

    参考:集合转数组的toArray()和toArray(T[] a)方法 1.ArrayList的toArray ArrayList提供了一个将List转为数组的一个非常方便的方法toArray.toA ...

  2. toString() toArray() 等to方法

    1.toString()方法toString()方法是把对象转成String类型的 println(Ojbect object)的方法他会自动调用被打印对象的toString方法,所以其实你的Syst ...

  3. List中toArray()的使用方法

    当我们需要把一个链表中的元素放入数组时,jdk给我们提供了一种方法,也即运用toArray(),方法的使用如下: public class Test { public static void main ...

  4. AbstractCollection类中的 T[] toArray(T[] a)方法源码解读

    一.源码解读 @SuppressWarnings("unchecked") public <T> T[] toArray(T[] a) { //size为集合的大小 i ...

  5. 为什么 Java ArrayList.toArray(T[]) 方法的参数类型是 T 而不是 E ?

    前两天给同事做 code review,感觉自己对 Java 的 Generics 掌握得不够好,便拿出 <Effective Java>1 这本书再看看相关的章节.在 Item 24:E ...

  6. 【转载】 C#中ArrayList使用ToArray方法转换为数组

    在C#的编程开发中,ArrayList集合是一个常用的非泛型类集合,可以使用ArrayList中的ToArray方法将ArrayList集合对象转换为数组,ToArray方法有2个重载形式,其一为vi ...

  7. code first提示已有打开的与此 Command 相关联的 DataReader,必须首先将它关闭解决方法

    使用codefirst查询当然是必不可少的,但有时不小心可能很简单的查询也会导致异常. 下面用codefirst做个示例简单演示下异常发生的场景: var attendlist = db.Databa ...

  8. Entity Framework 基于方法的查询语法

      实体框架(Entity Framework )是 ADO.NET 中的一套支持开发面向数据的软件应用程序的技术. LINQ to Entities 提供语言集成查询 (LINQ) 支持,它允许开发 ...

  9. zepto源码--核心方法(类数组相关)--学习笔记

    从这篇起,在没有介绍到各类插件之前,后面将陆续介绍zepto对外暴露的核心方法.即$.fn={}里面的所有方法的介绍.会配合zepto的API进行介绍. 其实前面已经介绍了几个,如width,heig ...

随机推荐

  1. API与软件架构-接口

    http://blog.csdn.net/horkychen/article/details/46612899 从架构设计的角度来看(所谓的组成论),软件系统就是模块和接口. 模块(层次/组件)决定分 ...

  2. 【SQL】sql update 多表关联更新方法总结

    #表结构: 1.表一:Test1 Id name age 1     2     2.表二:Test2 Id name age 1 小明 10 2 小红 8 #实现将表Test2的name和age字段 ...

  3. MetaMask/sw-controller

    https://github.com/MetaMask/sw-controller Service Worker Controller Used to register a service worke ...

  4. HTTPS协议,SSL协议及完整交互过程

    文章转自 https://blog.csdn.net/dfsaggsd/article/details/50910999 SSL 1.        安全套接字(Secure Socket Layer ...

  5. mybatis基础系列(三)——动态sql

    本文是Mybatis基础系列的第三篇文章,点击下面链接可以查看前面的文章: mybatis基础系列(二)--基础语法.别名.输入映射.输出映射 mybatis基础系列(一)--mybatis入门 动态 ...

  6. A类——Dima and a Bad XOR

    http://codeforces.com/contest/1151/problem/B 题意: 给一个矩阵,只要找到每一列的任意一个异或和大于0,就找到解并返回,输出TAK和位置,没找到就输出NIE ...

  7. ESP32 environment ubuntu

    ubuntu官方用的是16.04版本的,阿里源下载地址:http://mirrors.aliyun.com/ubuntu-releases/16.04/     用官方版本的好处就是省的搞一堆各种错误 ...

  8. QT 按钮的使用技巧

    按钮透明 //    ui->pushButton->setFlat( true );//    ui->pushButton->setStyleSheet( "QP ...

  9. u-boot全面分析

    uboot主Makefile分析1 uboot住Makefile分析参考:https://www.2cto.com/kf/201607/522424.html uboot version确定(Make ...

  10. (转)linux sudo 重定向,实现只有系统管理员才有权限操作的文件中写入信息

    众所周知,使用 echo 并配合命令重定向是实现向文件中写入信息的快捷方式. 本文介绍如何将 echo 命令与 sudo 命令配合使用,实现向那些只有系统管理员才有权限操作的文件中写入信息.   比如 ...