调通了导入prd上的各个功能。
This commit is contained in:
parent
efb9d4f055
commit
67fb0f2b39
|
|
@ -556,7 +556,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
List<EdFileInfo> deepCopyImport = JSONUtil.toList(JSONUtil.toJsonStr(importFiles), EdFileInfo.class);
|
||||
List<EdFileInfo> deepCopyDb = JSONUtil.toList(JSONUtil.toJsonStr(dbFileInfos), EdFileInfo.class);
|
||||
|
||||
// 导入的文件在线下已经被废除了
|
||||
// 导入的文件在线下已经被废除了,不同步到线上
|
||||
Optional<EdFileInfo> first = deepCopyImport.stream().filter(e -> e.getEffectFlag().equals(EffectFlagEnum.EFFECT.code)).findFirst();
|
||||
if (first.isEmpty()) {
|
||||
continue;
|
||||
|
|
@ -573,8 +573,10 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
} else {
|
||||
dbEffectFile = first1.get();
|
||||
}
|
||||
|
||||
// 如果导入的时间比数据库的时间新,则将导入的置为effect
|
||||
String effectId;
|
||||
// 如果数据库中的有效文件为null,则使用导入的
|
||||
if (ObjUtil.isNull(dbEffectFile)) {
|
||||
effectId = importEffectFile.getId();
|
||||
} else {
|
||||
|
|
@ -582,11 +584,12 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
}
|
||||
Map<String, String> importVersionRelation = getVersionRelation(deepCopyImport);
|
||||
Map<String, String> dbVersionRelation = getVersionRelation(deepCopyDb);
|
||||
|
||||
dbVersionRelation.putAll(importVersionRelation);
|
||||
|
||||
//**************************
|
||||
int start = FILE_START_VERSION;
|
||||
List<EdFileInfo> saveObjs = new ArrayList<>();
|
||||
importFiles = importFiles.stream().distinct().toList();
|
||||
for (EdFileInfo importFileInfo : importFiles) {
|
||||
// 该文件在数据库中存在,是从线上导出的。
|
||||
if (dbIdMap.containsKey(importFileInfo.getId())) {
|
||||
|
|
@ -594,14 +597,17 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
// 线下版本的修改时间比线上的新,用线下的版本
|
||||
if (dbFileInfo.getUpdatedTime().before(importFileInfo.getUpdatedTime())) {
|
||||
importFileInfo.setFileVersion(start);
|
||||
|
||||
saveObjs.add(importFileInfo);
|
||||
dbIdMap.remove(importFileInfo.getId());
|
||||
} else { // 线上版本的修改时间比线下新,用线上的版本。
|
||||
// 线上版本的修改时间比线下新,用线上的版本。
|
||||
} else {
|
||||
dbFileInfo.setFileVersion(start);
|
||||
saveObjs.add(dbFileInfo);
|
||||
dbIdMap.remove(dbFileInfo.getId());
|
||||
}
|
||||
} else { // 该文件是线下上传的。
|
||||
// 该文件是线下上传的。
|
||||
} else {
|
||||
importFileInfo.setFileVersion(start);
|
||||
saveObjs.add(importFileInfo);
|
||||
dbIdMap.remove(importFileInfo.getId());
|
||||
|
|
@ -610,8 +616,9 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
|||
}
|
||||
// 添加数据库中剩余的
|
||||
for (EdFileInfo edFileInfo : dbIdMap.values()) {
|
||||
edFileInfo.setFileVersion(++start);
|
||||
edFileInfo.setFileVersion(start);
|
||||
saveObjs.add(edFileInfo);
|
||||
++start;
|
||||
}
|
||||
//*************************
|
||||
for (EdFileInfo saveObj : saveObjs) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue