|
@@ -101,7 +101,7 @@ public class ChenYuTestScheduled {
|
|
|
private CloseableHttpClient httpClient;
|
|
|
private static final String TOKEN_REDIS_KEY = "blade:cqcy:token";
|
|
|
private static final String PROJECT_CODE = "cqcyfx";
|
|
|
- private static final String CONTRACT_CODE = "CYTJ03";
|
|
|
+ private static final String CONTRACT_CODE = "'CYTJ03'";
|
|
|
private static Long PROJECT_ID = null;
|
|
|
private static final String BASE_URL = "https://apicqcyfx.qdm123.com";
|
|
|
private final Map<String, Long> contractCodeMap = new ConcurrentHashMap<>();
|
|
@@ -253,6 +253,8 @@ public class ChenYuTestScheduled {
|
|
|
.eq(TrialCyFinishTestReport::getContractId, contractId));
|
|
|
//等会准备删除的历史数据
|
|
|
List<Long> ids = list.stream().map(TrialCyFinishTestReport::getId).collect(Collectors.toList());
|
|
|
+ //获取旧数据 task_id 与 id的映射关系
|
|
|
+ Map<Integer, Long> taskIdMap = list.stream().collect(Collectors.toMap(TrialCyFinishTestReport::getTaskId, TrialCyFinishTestReport::getId));
|
|
|
|
|
|
int pageIndex = 0;
|
|
|
final int pageSize = 100;
|
|
@@ -294,7 +296,10 @@ public class ChenYuTestScheduled {
|
|
|
for (TrialCyFinishTestReport report : reports) {
|
|
|
//数据太长且不需要
|
|
|
report.setTestParamInfo(null);
|
|
|
- Long id = SnowFlakeUtil.getId();
|
|
|
+ Long id = taskIdMap.get(report.getTaskId());
|
|
|
+ if(id == null){
|
|
|
+ id = SnowFlakeUtil.getId();
|
|
|
+ }
|
|
|
report.setId(id);
|
|
|
report.setContractId(contractId);
|
|
|
//处理boolean值
|
|
@@ -311,9 +316,10 @@ public class ChenYuTestScheduled {
|
|
|
//处理附件
|
|
|
List<TrialCyAccessories> accessories = report.getAccessories();
|
|
|
if (CollectionUtil.isNotEmpty(accessories)) {
|
|
|
+ Long finalId = id;
|
|
|
accessories.forEach(f -> {
|
|
|
f.setId(SnowFlakeUtil.getId());
|
|
|
- f.setReportId(id);
|
|
|
+ f.setReportId(finalId);
|
|
|
if (StringUtil.isNotBlank(f.getFilePath())) {
|
|
|
urls.add(f.getFilePath());
|
|
|
}
|
|
@@ -397,7 +403,8 @@ public class ChenYuTestScheduled {
|
|
|
.eq(TrialCyThirdReport::getContractId, contractId));
|
|
|
//等会要删除的id
|
|
|
List<Long> ids = list.stream().map(TrialCyThirdReport::getPKeyId).collect(Collectors.toList());
|
|
|
-
|
|
|
+ //获取旧数据 id 和 pKId的映射关系
|
|
|
+ Map<String, Long> linkMap = list.stream().collect(Collectors.toMap(TrialCyThirdReport::getId, TrialCyThirdReport::getPKeyId));
|
|
|
|
|
|
int pageIndex = 0;
|
|
|
final int pageSize = 100;
|
|
@@ -448,8 +455,11 @@ public class ChenYuTestScheduled {
|
|
|
if (StringUtil.isNotBlank(report.getRecordDocFilePath())) {
|
|
|
urls.add(report.getRecordDocFilePath());
|
|
|
}
|
|
|
-
|
|
|
- Long id = SnowFlakeUtil.getId();
|
|
|
+ //如果能通过id找到旧pkid 就使用旧pkid
|
|
|
+ Long id = linkMap.get(report.getId());
|
|
|
+ if(id == null){
|
|
|
+ id = SnowFlakeUtil.getId();
|
|
|
+ }
|
|
|
report.setPKeyId(id);
|
|
|
report.setContractId(contractId);
|
|
|
//报告类型
|
|
@@ -461,9 +471,10 @@ public class ChenYuTestScheduled {
|
|
|
//处理附件
|
|
|
List<TrialCyAccessories> accessories = report.getAccessories();
|
|
|
if (CollectionUtil.isNotEmpty(accessories)) {
|
|
|
+ Long finalId = id;
|
|
|
accessories.forEach(f -> {
|
|
|
f.setId(SnowFlakeUtil.getId());
|
|
|
- f.setReportId(id);
|
|
|
+ f.setReportId(finalId);
|
|
|
|
|
|
if (StringUtil.isNotBlank(f.getFilePath())) {
|
|
|
urls.add(f.getFilePath());
|