Browse Source

更新文件上传接收格式

hejq 7 years ago
parent
commit
bcd1c39070

+ 4 - 4
src/main/java/com/uas/platform/b2c/trade/order/controller/PurchaseProductController.java

@@ -1,5 +1,6 @@
 package com.uas.platform.b2c.trade.order.controller;
 
+import com.uas.platform.b2c.common.base.model.FileUpload;
 import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
 import com.uas.platform.b2c.core.support.view.JxlsExcelView;
 import com.uas.platform.b2c.prod.commodity.service.ReleaseProductByBatchService;
@@ -16,7 +17,6 @@ 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;
@@ -67,14 +67,14 @@ public class PurchaseProductController {
      * @see ResultMap
      */
     @RequestMapping(value = "/personal/release/excel", method = RequestMethod.POST)
-    public ResultMap releasePersonalProductByExcel(@RequestParam CommonsMultipartFile uploadItem, Integer ignoreImport) {
-        String fileName = uploadItem.getOriginalFilename();
+    public ResultMap releasePersonalProductByExcel(FileUpload uploadItem, Integer ignoreImport) {
+        String fileName = uploadItem.getFile().getOriginalFilename();
         // 获取EXCEL后缀格式
         String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
         InputStream inputStream;
         Workbook workbook;
         try {
-            inputStream = uploadItem.getInputStream();
+            inputStream = uploadItem.getFile().getInputStream();
             // 根据表格格式分开处理
             if (JxlsExcelView.EXCEL_XLS.equals(suffix)) {
                 workbook = new HSSFWorkbook(inputStream);

+ 1 - 1
src/main/java/com/uas/platform/b2c/trade/order/support/AjaxUtil.java

@@ -20,7 +20,7 @@ public class AjaxUtil {
      *
      * @param session HttpSession
      * @param isAjax 是否是ajax请求
-     * @return ModelAndView or null
+     * @return ModelAndView
      */
     public static ModelAndView checkIsAjax(HttpSession session, Boolean isAjax) {
         ModelAndView modelAndView = new ModelAndView();