|
@@ -5,18 +5,19 @@ import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.dromara.common.core.domain.R;
|
|
|
-import org.dromara.common.excel.core.DropDownOptions;
|
|
|
+import org.dromara.common.excel.core.ExcelResult;
|
|
|
import org.dromara.common.excel.utils.ExcelUtil;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.common.web.core.BaseController;
|
|
|
import org.dromara.dataManagement.domain.bo.SupplierBo;
|
|
|
+import org.dromara.dataManagement.domain.vo.SupplierExcelVo;
|
|
|
import org.dromara.dataManagement.domain.vo.SupplierVo;
|
|
|
import org.dromara.dataManagement.service.SupplierService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -41,7 +42,20 @@ public class SupplierController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping("/downloadTemplate")
|
|
|
public void getExampleExcel(HttpServletResponse response){
|
|
|
- ExcelUtil.exportExcel(new ArrayList<>(), "供应商导入模板", SupplierVo.class, response);
|
|
|
+ ExcelUtil.exportExcel(new ArrayList<>(), "供应商导入模板", SupplierExcelVo.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Excel导入供应商信息
|
|
|
+ * @param file
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @PostMapping("/importExcel")
|
|
|
+ public R<Void> importExcel(@RequestPart("file") MultipartFile file) throws Exception {
|
|
|
+ ExcelResult<SupplierExcelVo> result = ExcelUtil.importExcel(file.getInputStream(), SupplierExcelVo.class,false);
|
|
|
+ supplierService.insertImportExcel(result);
|
|
|
+ return R.ok(result.getAnalysis());
|
|
|
}
|
|
|
|
|
|
/**
|