|
|
@@ -5,6 +5,7 @@ import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.IoUtil;
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
import cn.hutool.poi.excel.ExcelWriter;
|
|
|
import cn.hutool.poi.excel.cell.CellUtil;
|
|
|
@@ -62,7 +63,7 @@ public class SysExportSheetServiceImpl implements ISysExportSheetService {
|
|
|
* @date 2023/05/15 20:48
|
|
|
*/
|
|
|
@Override
|
|
|
- public SysExportSheetDTO selectSysExportSheetById(String id){
|
|
|
+ public SysExportSheetDTO selectSysExportSheetById(String id) throws Exception {
|
|
|
SysExportSheetDTO result = SysExportSheetMapper.INSTANCE.convertDto(baseRepository.selectById(id));
|
|
|
if(ObjUtil.isNotNull(result)){
|
|
|
if(ObjUtil.isNull(result.getSuccessCount())||ObjUtil.equal(result.getSuccessCount(),0)){
|
|
|
@@ -75,7 +76,11 @@ public class SysExportSheetServiceImpl implements ISysExportSheetService {
|
|
|
if (SheetImportStatus.parsingSuccess.getValue().equals(result.getStatus()) &&
|
|
|
(ObjectUtil.equals(result.getTotalCount(), result.getSuccessCount() + result.getFailCount()))) {
|
|
|
result.setStatus(SheetImportStatus.importSuccess.getValue());
|
|
|
- baseRepository.updateById(SysExportSheetMapper.INSTANCE.convertPO(result));
|
|
|
+ SysExportSheetPO exportSheetPO = SysExportSheetMapper.INSTANCE.convertPO(result);
|
|
|
+ if(result.getFailCount()!=0){
|
|
|
+ exportSheetPO.setExportFileId(createImportFile(exportSheetPO));
|
|
|
+ }
|
|
|
+ baseRepository.updateById(exportSheetPO);
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
@@ -163,7 +168,7 @@ public class SysExportSheetServiceImpl implements ISysExportSheetService {
|
|
|
excelSheetManage.clear(sheet.getId());
|
|
|
}
|
|
|
|
|
|
- private String createImportFile(SysExportSheetPO sheetPO) throws Exception {
|
|
|
+ public String createImportFile(SysExportSheetPO sheetPO) throws Exception {
|
|
|
String sheetId = sheetPO.getId();
|
|
|
byte[] fileContent = sysStorageApi.obtainContent(sheetPO.getImportFileId());
|
|
|
List<SysExportRowDTO> rowRecords = rowService.selectSysExportRowBySheetId(sheetId);
|