From a23355ac5bfcaf8473767c45eba6d6315880b9c5 Mon Sep 17 00:00:00 2001 From: BBIT-Kai <2911862937@qq.com> Date: Wed, 15 Apr 2026 15:20:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=EF=BC=9B=E5=8E=BB=E9=99=A4=E5=9B=BD?= =?UTF-8?q?=E5=A4=96=E5=BC=80=E6=BA=90=E5=9C=B0=E5=9B=BE=E8=BD=AF=E4=BB=B6?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=9B=E6=89=B9=E6=AC=A1=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=90=8E=E4=BB=8D=E5=8F=AF=E7=BC=96=E8=BE=91=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- f10/build.gradle.kts | 2 +- f10/src/main/kotlin/TraceabilityService.kt | 16 +- f10/src/main/resources/application.yaml | 4 +- .../main/resources/templates/traceability.ftl | 90 +++- .../server/utils/dao/TraceabilityDao.kt | 8 +- .../web-antd/src/views/traceability/admin.vue | 38 +- .../components/CoordinateFieldEditor.vue | 264 +--------- .../src/views/traceability/operator.vue | 462 ++++++++++++++---- .../web-antd/src/views/traceability/shared.ts | 4 +- 9 files changed, 493 insertions(+), 395 deletions(-) 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 @@