diff --git a/f10/build.gradle.kts b/f10/build.gradle.kts index 2280d2c..ae374ab 100644 --- a/f10/build.gradle.kts +++ b/f10/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } group = "com.bbitcn" -version = "0.0.4" +version = "0.0.5" application { mainClass = "io.ktor.server.netty.EngineMain" diff --git a/f10/src/main/kotlin/TraceabilityService.kt b/f10/src/main/kotlin/TraceabilityService.kt index fcd32f0..d92ba9b 100644 --- a/f10/src/main/kotlin/TraceabilityService.kt +++ b/f10/src/main/kotlin/TraceabilityService.kt @@ -110,7 +110,17 @@ class TraceabilityService( value.entries.joinToString(";") { "${it.key}: ${formatJsonValue(it.value)}" } } } - else -> value.toString().trim('"').ifBlank { "未填写" } + else -> normalizeDisplayText(value.toString().trim('"')) + } + + private fun normalizeDisplayText(text: String): String { + if (text.isBlank()) { + return "未填写" + } + return text + .replace("\\r\\n", "\n") + .replace("\\n", "\n") + .replace("\\t", "\t") } private fun formatDateOnly(value: String): String { @@ -126,7 +136,7 @@ class TraceabilityService( val lng = coordinate["lng"]?.jsonPrimitive?.doubleOrNull val lat = coordinate["lat"]?.jsonPrimitive?.doubleOrNull return when { - lng != null && lat != null -> "https://www.openstreetmap.org/?mlat=$lat&mlon=$lng#map=15/$lat/$lng" + lng != null && lat != null -> "https://uri.amap.com/marker?position=$lng,$lat&name=坐标位置&src=traceability" else -> "" } } @@ -135,7 +145,7 @@ class TraceabilityService( val coordinate = value as? JsonObject ?: return "" val lng = coordinate["lng"]?.jsonPrimitive?.doubleOrNull ?: return "" val lat = coordinate["lat"]?.jsonPrimitive?.doubleOrNull ?: return "" - return "https://www.openstreetmap.org/export/embed.html?bbox=${lng - 0.01}%2C${lat - 0.01}%2C${lng + 0.01}%2C${lat + 0.01}&layer=mapnik&marker=$lat%2C$lng" + return "https://uri.amap.com/marker?position=$lng,$lat&name=坐标位置&src=traceability&callnative=0" } private fun buildPageViewModel( diff --git a/f10/src/main/resources/application.yaml b/f10/src/main/resources/application.yaml index 1400159..16ca0de 100644 --- a/f10/src/main/resources/application.yaml +++ b/f10/src/main/resources/application.yaml @@ -7,5 +7,5 @@ ktor: traceability: # 访问主服务的地址 -# core-base-url: "http://127.0.0.1:8089" # 开发 - core-base-url: "https://ai.ronsunny.cn:8090/api" # 生产 + core-base-url: "http://127.0.0.1:8089" # 开发 +# core-base-url: "https://ai.ronsunny.cn:8090/api" # 生产 diff --git a/f10/src/main/resources/templates/traceability.ftl b/f10/src/main/resources/templates/traceability.ftl index 808365f..e57bdb1 100644 --- a/f10/src/main/resources/templates/traceability.ftl +++ b/f10/src/main/resources/templates/traceability.ftl @@ -5,6 +5,7 @@