diff --git a/app/src/main/java/com/navinfo/omqs/db/ImportOMDBHelper.kt b/app/src/main/java/com/navinfo/omqs/db/ImportOMDBHelper.kt index b3075f93..c7b0cbdd 100644 --- a/app/src/main/java/com/navinfo/omqs/db/ImportOMDBHelper.kt +++ b/app/src/main/java/com/navinfo/omqs/db/ImportOMDBHelper.kt @@ -177,7 +177,7 @@ class ImportOMDBHelper @AssistedInject constructor( it.name == currentConfig.table } // 将listResult数据插入到Realm数据库中 - val listResult = mutableListOf() +// val listResult = mutableListOf() currentConfig?.let { val list = FileIOUtils.readFile2List(txtFile, "UTF-8") Log.d("ImportOMDBHelper", "开始解析:${txtFile?.name}") @@ -332,28 +332,28 @@ class ImportOMDBHelper @AssistedInject constructor( } } - //交限增加相同LinkIn与LinkOut过滤原则 - if (renderEntity.code == DataCodeEnum.OMDB_RESTRICTION.code) { - if (renderEntity.properties.containsKey("linkIn") && renderEntity.properties.containsKey( - "linkOut" - ) - ) { - var linkIn = renderEntity.properties["linkIn"] - var linkOut = renderEntity.properties["linkOut"] - if (linkIn != null && linkOut != null) { - var checkMsg = "$linkIn$linkOut" - if (resHashMap.containsKey(checkMsg)) { - Log.e( - "qj", - "${renderEntity.name}==过滤交限linkin与linkout相同且存在多条数据" - ) - continue - } else { - resHashMap.put(checkMsg, renderEntity) - } - } - } - } +// //交限增加相同LinkIn与LinkOut过滤原则 +// if (renderEntity.code == DataCodeEnum.OMDB_RESTRICTION.code) { +// if (renderEntity.properties.containsKey("linkIn") && renderEntity.properties.containsKey( +// "linkOut" +// ) +// ) { +// var linkIn = renderEntity.properties["linkIn"] +// var linkOut = renderEntity.properties["linkOut"] +// if (linkIn != null && linkOut != null) { +// var checkMsg = "$linkIn$linkOut" +// if (resHashMap.containsKey(checkMsg)) { +// Log.e( +// "qj", +// "${renderEntity.name}==过滤交限linkin与linkout相同且存在多条数据" +// ) +// continue +// } else { +// resHashMap.put(checkMsg, renderEntity) +// } +// } +// } +// } //遍历判断只显示与任务Link相关的任务数据 if (currentConfig.checkLinkId) { @@ -619,17 +619,17 @@ class ImportOMDBHelper @AssistedInject constructor( renderEntity.properties["startTime"] = "null" } } - listResult.add(renderEntity) +// listResult.add(renderEntity) realm.insert(renderEntity) } } } } - // 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用 - if (currentConfig.table == "OMDB_RD_LINK") { - importConfig.preProcess.cacheRdLink = - listResult.associateBy { it.properties["linkPid"] } - } +// // 如果当前解析的是OMDB_RD_LINK数据,将其缓存在预处理类中,以便后续处理其他要素时使用 +// if (currentConfig.table == "OMDB_RD_LINK") { +// importConfig.preProcess.cacheRdLink = +// listResult.associateBy { it.properties["linkPid"] } +// } realm.commitTransaction() // 1个文件发送一次flow流 emit("${++processIndex}/${tableNum}") @@ -637,8 +637,6 @@ class ImportOMDBHelper @AssistedInject constructor( } catch (e: Exception) { realm.cancelTransaction() throw e - } finally { - realm.close() } } emit("finish") diff --git a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt index 276e76f8..cf2396e8 100644 --- a/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt +++ b/app/src/main/java/com/navinfo/omqs/db/ImportPreProcess.kt @@ -20,23 +20,23 @@ class ImportPreProcess { val defaultTranslateDistance = 3.0 val testFlag:Boolean = true fun checkCircleRoad(renderEntity: RenderEntity): Boolean { - val linkInId = renderEntity.properties["linkIn"] - val linkOutId = renderEntity.properties["linkOut"] - // 根据linkIn和linkOut获取对应的link数据 - val linkInEntity = cacheRdLink[linkInId] - val linkOutEntity = cacheRdLink[linkOutId] - Log.d( - "checkCircleRoad", - "LinkInEntity: ${linkInId}- ${linkInEntity?.properties?.get("snodePid")},LinkOutEntity: ${linkOutId}- ${ - linkOutEntity?.properties?.get("enodePid") - }" - ) - // 查询linkIn的sNode和linkOut的eNode是否相同,如果相同,认为数据是环形路口,返回false - if (linkInEntity != null && linkOutEntity != null) { - if (linkInEntity.properties["snodePid"] == linkOutEntity.properties["enodePid"] || linkInEntity.properties["enodePid"] == linkOutEntity.properties["snodePid"] || linkInEntity.properties["snodePid"] == linkOutEntity.properties["snodePid"] || linkInEntity.properties["enodePid"] == linkOutEntity.properties["enodePid"]) { - return false - } - } +// val linkInId = renderEntity.properties["linkIn"] +// val linkOutId = renderEntity.properties["linkOut"] +// // 根据linkIn和linkOut获取对应的link数据 +// val linkInEntity = cacheRdLink[linkInId] +// val linkOutEntity = cacheRdLink[linkOutId] +// Log.d( +// "checkCircleRoad", +// "LinkInEntity: ${linkInId}- ${linkInEntity?.properties?.get("snodePid")},LinkOutEntity: ${linkOutId}- ${ +// linkOutEntity?.properties?.get("enodePid") +// }" +// ) +// // 查询linkIn的sNode和linkOut的eNode是否相同,如果相同,认为数据是环形路口,返回false +// if (linkInEntity != null && linkOutEntity != null) { +// if (linkInEntity.properties["snodePid"] == linkOutEntity.properties["enodePid"] || linkInEntity.properties["enodePid"] == linkOutEntity.properties["snodePid"] || linkInEntity.properties["snodePid"] == linkOutEntity.properties["snodePid"] || linkInEntity.properties["enodePid"] == linkOutEntity.properties["enodePid"]) { +// return false +// } +// } return true }