|
@@ -31,6 +31,8 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.ByteArrayInputStream;
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileOutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -522,20 +524,20 @@ public class StandardController {
|
|
|
//todo 只保留错误数据的sheet
|
|
|
Workbook wb = poiUtils.exportErrorXls(0,validateColIndex,1 + insertCount + failCount);
|
|
|
|
|
|
- //todo 将wb保存到oss
|
|
|
- ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
- wb.write(output);
|
|
|
-
|
|
|
- byte[] buffer = output.toByteArray();
|
|
|
- ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
-
|
|
|
- //格式化
|
|
|
+ //todo 将wb保存
|
|
|
SimpleDateFormat sim = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
String fileName = "error" + sim.format(new Date()) + ".xls";
|
|
|
- String downloadUrl = OSSUtil.upload(ossConfig,"prices",fileName,input);
|
|
|
+ String name = "D:\\Tomcat10\\webapps\\prices-portal\\xls\\" + fileName;
|
|
|
+ File file = new File(name);
|
|
|
+ FileOutputStream file1 = new FileOutputStream(file);
|
|
|
+ wb.write(file1);
|
|
|
+ file1.close();
|
|
|
+ wb.close();
|
|
|
+ output.close();
|
|
|
|
|
|
//todo 返回导入失败报表下载链接
|
|
|
- msgResult.setData(downloadUrl);
|
|
|
+ msgResult.setData("/xls/" + fileName);
|
|
|
}
|
|
|
else{
|
|
|
msgResult.setResult(true);
|