Bläddra i källkod

试验-接入成渝第三方接口开发
1、删除数据根据对方的唯一主键删除

LHB 17 timmar sedan
förälder
incheckning
864b3bfc10

+ 7 - 4
blade-service/blade-business/src/main/java/org/springblade/business/scheduled/ChenYuTestScheduled.java

@@ -384,8 +384,6 @@ public class ChenYuTestScheduled {
                         }
                     }
                     if (CollectionUtil.isNotEmpty(ids)) {
-                        trialCyFinishTestReportService.removeBatchByIds(ids);
-
                         List<String> fileUrls = list.stream().map(TrialCyFinishTestReport::getAssembleFile).filter(StringUtil::isNotBlank).collect(Collectors.toList());
                         if(CollectionUtil.isNotEmpty(fileUrls)){
                             //删除组合文件
@@ -393,8 +391,12 @@ public class ChenYuTestScheduled {
                                 String pdfName = f.split("upload")[1];
                                 this.newIOSSClient.removeFile("upload" + pdfName);
                             });
+                            ids.clear();
                         }
                     }
+                    //获取taskId,把之前的taskId删除
+                    List<Integer> taskIds = reports.stream().map(TrialCyFinishTestReport::getTaskId).collect(Collectors.toList());
+                    trialCyFinishTestReportService.remove(Wrappers.<TrialCyFinishTestReport>lambdaQuery().in(TrialCyFinishTestReport::getTaskId,taskIds));
 
                     trialCyFinishTestReportService.saveBatch(reports);
                     hasMore = reports.size() >= pageSize;
@@ -535,7 +537,6 @@ public class ChenYuTestScheduled {
                         }
                         //删除旧数据
                         if (CollectionUtil.isNotEmpty(ids)) {
-                            trialCyThirdReportService.removeBatchByIds(ids);
                             List<String> fileUrls = list.stream().map(TrialCyThirdReport::getAssembleFile).filter(StringUtil::isNotBlank).collect(Collectors.toList());
                             if(CollectionUtil.isNotEmpty(fileUrls)){
                                 //删除组合文件
@@ -543,9 +544,11 @@ public class ChenYuTestScheduled {
                                     String pdfName = f.split("upload")[1];
                                     this.newIOSSClient.removeFile("upload" + pdfName);
                                 });
+                                ids.clear();
                             }
                         }
-
+                        List<String> collect = reports.stream().map(TrialCyThirdReport::getId).collect(Collectors.toList());
+                        trialCyThirdReportService.remove(Wrappers.<TrialCyThirdReport>lambdaQuery().in(TrialCyThirdReport::getId, collect));
                         //添加新数据
                         trialCyThirdReportService.saveBatch(reports);
                         hasMore = reports.size() >= pageSize;