|
|
@@ -96,24 +96,18 @@ public class ProductUsersController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/edit/release/excel", method = RequestMethod.POST)
|
|
|
public ModelMap releaseByExcel(FileUpload uploadItem) throws IllegalOperatorException, IOException {
|
|
|
- ModelMap map = new ModelMap();
|
|
|
String fileName = uploadItem.getFile().getOriginalFilename();
|
|
|
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
|
|
- InputStream is = null;
|
|
|
- Workbook workbook = null;
|
|
|
-// try {
|
|
|
- is = uploadItem.getFile().getInputStream();
|
|
|
- if ("xls".equals(suffix)) {
|
|
|
+ InputStream is = uploadItem.getFile().getInputStream();
|
|
|
+ Workbook workbook;
|
|
|
+ if (JxlsExcelView.EXCEL_XLS.equals(suffix)) {
|
|
|
workbook = new HSSFWorkbook(is);
|
|
|
- } else if ("xlsx".equals(suffix)) {
|
|
|
+ } else if (JxlsExcelView.EXCEL_XLSX.equals(suffix)) {
|
|
|
workbook = new XSSFWorkbook(is);
|
|
|
} else {
|
|
|
throw new IllegalOperatorException("文件格式不正确,请上传.xls或.xlsx的文件");
|
|
|
}
|
|
|
- map = productUsersService.releaseByWorkbook(workbook);
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
+ ModelMap map = productUsersService.releaseByWorkbook(workbook);
|
|
|
logger.log("商品批次", "[" + SystemSession.getUser().getUserName() + "]通过excel导入了个人物料,数量为" + map.get("success"));
|
|
|
return map;
|
|
|
}
|