|
@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -39,7 +40,7 @@ public class RmsMaterialSteelServiceImpl implements IRmsMaterialSteelService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Map<String, Object> getMaterialFurnaceNumber() {
|
|
|
|
|
|
+ public List<Map<String, Object>> getMaterialFurnaceNumber() {
|
|
return rmsMaterialSteelMapper.getMaterialFurnaceNumber();
|
|
return rmsMaterialSteelMapper.getMaterialFurnaceNumber();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -56,33 +57,35 @@ public class RmsMaterialSteelServiceImpl implements IRmsMaterialSteelService {
|
|
|
|
|
|
/**
|
|
/**
|
|
* PDF文件上传
|
|
* PDF文件上传
|
|
- * @param file
|
|
|
|
|
|
+ * @param files
|
|
* @param request
|
|
* @param request
|
|
* @return
|
|
* @return
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Map<String, String> upFile(MultipartFile file, HttpServletRequest request) throws IOException {
|
|
|
|
|
|
+ public Map<String, String> upFile(MultipartFile[] files, HttpServletRequest request) throws IOException {
|
|
Map<String, String> map = new HashMap<>();
|
|
Map<String, String> map = new HashMap<>();
|
|
map.put("code", "500");
|
|
map.put("code", "500");
|
|
map.put("msg", "上传文件失败");
|
|
map.put("msg", "上传文件失败");
|
|
- String fileName = file.getOriginalFilename();//获取文件名
|
|
|
|
- String suffixName = fileName.substring(fileName.lastIndexOf("."));//获取文件的后缀名
|
|
|
|
- // 得到文件名的前缀
|
|
|
|
- String capacityNumberAndFurnaceNumber = fileName.substring(0,fileName.lastIndexOf("."));
|
|
|
|
- //上传的文件名也需要加上后缀,不然虚拟机不知道文件格式
|
|
|
|
- InputStream inputStream = file.getInputStream();
|
|
|
|
- String filePath = null;
|
|
|
|
- //关于ftp处理文件上传下载这里单独写了一个工具类ftpUtil,下面会写这个类
|
|
|
|
- //@Autowired private FtpUtil ftpUtil;service层上面引入了这个方法。
|
|
|
|
- Boolean flag = ftpUtil.uploadFile(fileName, inputStream);//主要就是这里实现了ftp的文件上传
|
|
|
|
- if (flag == true) {
|
|
|
|
- //log.info("上传文件成功!");
|
|
|
|
- filePath = ftpUtil.FTP_BASEPATH + fileName;
|
|
|
|
- map.put("code", "200");
|
|
|
|
- map.put("msg", "上传文件成功");
|
|
|
|
|
|
+ for (MultipartFile file : files) {
|
|
|
|
+ String fileName = file.getOriginalFilename();//获取文件名
|
|
|
|
+ String suffixName = fileName.substring(fileName.lastIndexOf("."));//获取文件的后缀名
|
|
|
|
+ // 得到文件名的前缀
|
|
|
|
+ String capacityNumberAndFurnaceNumber = fileName.substring(0, fileName.lastIndexOf("."));
|
|
|
|
+ //上传的文件名也需要加上后缀,不然虚拟机不知道文件格式
|
|
|
|
+ InputStream inputStream = file.getInputStream();
|
|
|
|
+ String filePath = null;
|
|
|
|
+ //关于ftp处理文件上传下载这里单独写了一个工具类ftpUtil,下面会写这个类
|
|
|
|
+ //@Autowired private FtpUtil ftpUtil;service层上面引入了这个方法。
|
|
|
|
+ Boolean flag = ftpUtil.uploadFile(fileName, inputStream);//主要就是这里实现了ftp的文件上传
|
|
|
|
+ if (flag == true) {
|
|
|
|
+ //log.info("上传文件成功!");
|
|
|
|
+ filePath = ftpUtil.FTP_BASEPATH + fileName;
|
|
|
|
+ map.put("code", "200");
|
|
|
|
+ map.put("msg", "上传文件成功");
|
|
|
|
+ }
|
|
|
|
+ map.put("path", filePath);
|
|
}
|
|
}
|
|
- map.put("path", filePath);
|
|
|
|
System.out.println(map);
|
|
System.out.println(map);
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|