|
|
@ -10,6 +10,7 @@ import com.aspose.cells.Workbook; |
|
|
|
import com.aspose.cells.Worksheet; |
|
|
|
import com.inscloudtech.analysiscenter.domain.AnalysisDto; |
|
|
|
import com.inscloudtech.bankStatementAnalysis.helper.HelperUtil; |
|
|
|
import com.inscloudtech.bankStatementAnalysis.service.ImportService; |
|
|
|
import com.inscloudtech.bankStatementAnalysis.util.AsposeUtil; |
|
|
|
import com.inscloudtech.common.annotation.Log; |
|
|
|
import com.inscloudtech.common.annotation.UpdateLog; |
|
|
@ -56,8 +57,9 @@ import java.util.*; |
|
|
|
public class RealEstateController extends BaseController { |
|
|
|
|
|
|
|
private final IRealEstateService iRealEstateService; |
|
|
|
|
|
|
|
private final ISysOssService iSysOssService; |
|
|
|
private final ImportService importService; |
|
|
|
|
|
|
|
|
|
|
|
//"保存至分析成果") |
|
|
|
@PostMapping("/save2AnalysisResult") |
|
|
@ -82,28 +84,7 @@ public class RealEstateController extends BaseController { |
|
|
|
String importResultStr = ""; |
|
|
|
int importCount = 0; |
|
|
|
try { |
|
|
|
|
|
|
|
// 获取文件名和扩展名 |
|
|
|
String suffix = FileUtil.getSuffix(file.getOriginalFilename()); |
|
|
|
// 创建临时文件 |
|
|
|
Path tempFilePath = Files.createTempFile("temp", "." + suffix); |
|
|
|
File tempFile = tempFilePath.toFile(); |
|
|
|
// 写入文件内容 |
|
|
|
try (InputStream inputStream = file.getInputStream()) { |
|
|
|
Files.copy(inputStream, tempFilePath, StandardCopyOption.REPLACE_EXISTING); |
|
|
|
} |
|
|
|
Workbook wb = new Workbook(tempFile.getAbsolutePath()); |
|
|
|
List<RealEstate> list = new ArrayList<>(); |
|
|
|
int count = wb.getWorksheets().getCount(); |
|
|
|
for (int sheetNo = 0; sheetNo < count; sheetNo++) { |
|
|
|
Worksheet worksheet = wb.getWorksheets().get(sheetNo); |
|
|
|
Cells cells = worksheet.getCells(); |
|
|
|
Cell flagCell = AsposeUtil.getCell(cells, "房产地址"); |
|
|
|
Integer headRowNumber = flagCell.getRow() + 1; |
|
|
|
ImportExcelHelper<RealEstate> helper = new ImportExcelHelper<>(); |
|
|
|
List<RealEstate> tempList = helper.getListWithInputStream(file.getInputStream(), RealEstate.class, sheetNo, headRowNumber); |
|
|
|
list.addAll(tempList); |
|
|
|
} |
|
|
|
List<RealEstate> list = importService.importMergeExcel(file, RealEstate.class,"房产地址"); |
|
|
|
// ExcelResult<RealEstate> excelResult = ExcelUtil.importExcel(file.getInputStream(), RealEstate.class, true); |
|
|
|
// List<RealEstate> list = excelResult.getList(); |
|
|
|
if(CollectionUtil.isNotEmpty(list)){ |
|
|
|