|
|
@ -28,18 +28,24 @@ package com.yxt.supervise.portal.biz.gdinventory; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.io.FileUtil; |
|
|
|
import cn.hutool.core.text.csv.*; |
|
|
|
import cn.hutool.poi.excel.ExcelReader; |
|
|
|
import cn.hutool.poi.excel.ExcelUtil; |
|
|
|
import cn.hutool.poi.excel.sax.handler.RowHandler; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.core.result.FileUploadResult; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.supervise.portal.biz.storeindex.StoreIndexService; |
|
|
|
import com.yxt.supervise.portal.extexcel.CsvTool; |
|
|
|
import com.yxt.supervise.portal.extexcel.ExcelTool; |
|
|
|
import org.apache.poi.ss.usermodel.CellStyle; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import java.io.FileNotFoundException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.nio.charset.Charset; |
|
|
|
import java.nio.file.Paths; |
|
|
|
import java.util.ArrayList; |
|
|
@ -67,6 +73,8 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento |
|
|
|
private GdInventoryOkService gdInventoryOkService; |
|
|
|
@Autowired |
|
|
|
private StoreIndexService storeIndexService; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
|
|
|
|
public void doCheck() { |
|
|
|
|
|
|
@ -326,4 +334,30 @@ public class GdInventoryService extends ServiceImpl<GdInventoryMapper, GdInvento |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean importAndCount(MultipartFile file) { |
|
|
|
|
|
|
|
ResultBean<FileUploadResult> fub = fileUploadComponent.uploadFile(file); |
|
|
|
String filePath = fub.getData().getFilePath(); |
|
|
|
String fp = fileUploadComponent.getUploadPath() + filePath; |
|
|
|
|
|
|
|
long millis = System.currentTimeMillis(); |
|
|
|
// InputStream inputStream = null;
|
|
|
|
// try {
|
|
|
|
// inputStream = file.getInputStream();
|
|
|
|
// } catch (IOException e) {
|
|
|
|
// throw new RuntimeException(e);
|
|
|
|
// }
|
|
|
|
ExcelUtil.read07BySax(fp, -1, createRowHandler()); |
|
|
|
// ExcelReader reader = ExcelUtil.getReader(fp);
|
|
|
|
// int rowCount = reader.getRowCount();
|
|
|
|
// for (int i = 0; i < rowCount; i++) {
|
|
|
|
// List<Object> objList = reader.readRow(i);
|
|
|
|
// System.out.println("" + i + " , " + objList.toString());
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("用时:" + (System.currentTimeMillis() - millis)); |
|
|
|
return ResultBean.fireSuccess(); |
|
|
|
} |
|
|
|
} |
|
|
|