Explorar o código

Merge branch 'master' into biz-lims-dev

# Conflicts:
#	tr-test/src/main/java/cn/tr/test/WebApplication.java
18339543638 %!s(int64=2) %!d(string=hai) anos
pai
achega
4e8c305584

+ 1 - 1
tr-modules/tr-module-export/src/main/java/cn/tr/module/excel/sheet/service/ISysExportSheetService.java

@@ -19,7 +19,7 @@ public interface ISysExportSheetService{
      * @author   lf
      * @date      2023/05/15 20:48
      */
-    SysExportSheetDTO selectSysExportSheetById(String id);
+    SysExportSheetDTO selectSysExportSheetById(String id) throws Exception;
 
 
     /**

+ 8 - 3
tr-modules/tr-module-export/src/main/java/cn/tr/module/excel/sheet/service/impl/SysExportSheetServiceImpl.java

@@ -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);