优化代码
This commit is contained in:
parent
73b99308be
commit
e27c3d9c65
|
|
@ -465,18 +465,19 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
OutputStream outputStream = Files.newOutputStream(Paths.get(zipDirPath))
|
OutputStream outputStream = Files.newOutputStream(Paths.get(zipDirPath))
|
||||||
) {
|
) {
|
||||||
aes.decrypt(inputStream, outputStream, true);
|
aes.decrypt(inputStream, outputStream, true);
|
||||||
|
String uuid = IdUtil.fastSimpleUUID();
|
||||||
|
String tmpDir = elePropertyConfig.getUploadDataDir(dataOwnCode) + currentUserId + File.separator + uuid + File.separator;
|
||||||
|
ZipUtil.unzip(zipDirPath, tmpDir);
|
||||||
|
update2Database(tmpDir, dataOwnCode);
|
||||||
|
UserThreadLocal.setSuccessInfo("", "", "导入数据库成功,文件名称为 " + mainName);
|
||||||
|
return ElectromagneticResultUtil.success(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String info = "文件上传错误";
|
String info = "文件上传错误";
|
||||||
log.error(info, e);
|
log.error(info, e);
|
||||||
throw new BizException(info);
|
throw new BizException(info);
|
||||||
|
} finally {
|
||||||
|
fileSystemService.deleteFile(zipDirPath, destColibPath);
|
||||||
}
|
}
|
||||||
String uuid = IdUtil.fastSimpleUUID();
|
|
||||||
String tmpDir = elePropertyConfig.getUploadDataDir(dataOwnCode) + currentUserId + File.separator + uuid + File.separator;
|
|
||||||
ZipUtil.unzip(zipDirPath, tmpDir);
|
|
||||||
update2Database(tmpDir, dataOwnCode);
|
|
||||||
fileSystemService.deleteFile(zipDirPath, destColibPath);
|
|
||||||
UserThreadLocal.setSuccessInfo("", "", "导入数据库成功,文件名称为 " + mainName);
|
|
||||||
return ElectromagneticResultUtil.success(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
||||||
|
|
@ -682,7 +683,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
String id = saveObj.getId();
|
String id = saveObj.getId();
|
||||||
String preVersionId = dbVersionRelation.get(id);
|
String preVersionId = dbVersionRelation.get(id);
|
||||||
EdFileInfo tmp = importIdMap.get(preVersionId);
|
EdFileInfo tmp = importIdMap.get(preVersionId);
|
||||||
saveObj.setPreVersion(ObjUtil.isNull(tmp) ? null : tmp.getFileVersion());
|
saveObj.setPreVersion(Optional.ofNullable(tmp).map(EdFileInfo::getFileVersion).orElse(null));
|
||||||
int effect = ObjUtil.equals(saveObj.getId(), effectId) ? EffectFlagEnum.EFFECT.code : EffectFlagEnum.NOT_EFFECTIVE.code;
|
int effect = ObjUtil.equals(saveObj.getId(), effectId) ? EffectFlagEnum.EFFECT.code : EffectFlagEnum.NOT_EFFECTIVE.code;
|
||||||
saveObj.setEffectFlag(effect);
|
saveObj.setEffectFlag(effect);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue