|
|
@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -68,13 +69,17 @@ public class PurchaseProductController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/personal/release/excel", method = RequestMethod.POST)
|
|
|
public ResultMap releasePersonalProductByExcel(FileUpload uploadItem, Integer ignoreImport) {
|
|
|
- String fileName = uploadItem.getFile().getOriginalFilename();
|
|
|
+ CommonsMultipartFile file = uploadItem.getFile();
|
|
|
+ if (null == file) {
|
|
|
+ return ResultMap.error(new IllegalOperatorException("请上传excel文件"));
|
|
|
+ }
|
|
|
+ String fileName = file.getOriginalFilename();
|
|
|
// 获取EXCEL后缀格式
|
|
|
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
|
|
InputStream inputStream;
|
|
|
Workbook workbook;
|
|
|
try {
|
|
|
- inputStream = uploadItem.getFile().getInputStream();
|
|
|
+ inputStream = file.getInputStream();
|
|
|
// 根据表格格式分开处理
|
|
|
if (JxlsExcelView.EXCEL_XLS.equals(suffix)) {
|
|
|
workbook = new HSSFWorkbook(inputStream);
|