Quellcode durchsuchen

数量转换成k或者万

bihuisong vor 18 Stunden
Ursprung
Commit
cf4b7a1089

+ 19 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/NumberUtils.java

@@ -0,0 +1,19 @@
+package com.ruoyi.web.controller.tool;
+
+public class NumberUtils {
+
+    public static String thousandFormatCount(long count) {
+        if (count >= 10000) {
+            return String.format("%.1fK", count / 1000.0);
+        }
+        return String.valueOf(count);
+    }
+
+    public static String tenThousandFormatCount(long count) {
+        if (count >= 100000) {
+            return String.format("%.1f万", count / 10000.0);
+        }
+        return String.valueOf(count);
+    }
+
+}

+ 6 - 6
ruoyi-admin/src/main/resources/templates/InteractiveColumns.html

@@ -54,8 +54,8 @@
                                         </span>
                                     </div>
                                     <div class="w15"><span th:text="${item.municipalReply + '%'}"></span></div>
-                                    <div class="w15"><span th:text="${item.leaveCount}"></span></div>
-                                    <div class="w15"><span th:text="${item.replyCount}"></span></div>
+                                    <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.leaveCount)}"></span></div>
+                                    <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.replyCount)}"></span></div>
                                     <img class="table-triangle-top" th:src="@{img/triangle.png}"/>
                                     <img class="table-triangle-btm" th:src="@{img/triangle.png}"/>
                                 </li>
@@ -87,8 +87,8 @@
                                         </span>
                                     </div>
                                     <div class="w15"><span th:text="${item.areaReply + '%'}"></span></div>
-                                    <div class="w15"><span th:text="${item.areaLeaveCount}"></span></div>
-                                    <div class="w15"><span th:text="${item.areaReplyCount}"></span></div>
+                                    <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.areaLeaveCount)}"></span></div>
+                                    <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.areaReplyCount)}"></span></div>
                                     <img class="table-triangle-top" th:src="@{img/triangle.png}"/>
                                     <img class="table-triangle-btm" th:src="@{img/triangle.png}"/>
                                 </li>
@@ -120,8 +120,8 @@
                                         </span>
                                     </div>
                                     <div class="w15"><span th:text="${item.countyReply + '%'}"></span></div>
-                                    <div class="w15"><span th:text="${item.countyLeaveCount}"></span></div>
-                                    <div class="w15"><span th:text="${item.countyReplyCount}"></span></div>
+                                    <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.countyLeaveCount)}"></span></div>
+                                    <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.countyReplyCount)}"></span></div>
                                     <img class="table-triangle-top" th:src="@{img/triangle.png}"/>
                                     <img class="table-triangle-btm" th:src="@{img/triangle.png}"/>
                                 </li>

+ 2 - 2
ruoyi-admin/src/main/resources/templates/dailyUpdateVolume.html

@@ -37,7 +37,7 @@
                                     <div class="gov-name" th:attr="title=${item.renewName}" th:text="${#strings.length(item.renewName) > 20}
                   ? ${#strings.substring(item.renewName, 0, 20) + '...'}
                   : ${item.renewName}"></div>
-                                    <div class="click-num" th:text="${item.renewCount}"><span
+                                    <div class="click-num" th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).tenThousandFormatCount(item.renewCount)}"><span
                                             class="font-small-size">条</span></div>
                                 </li>
                             </ul>
@@ -51,7 +51,7 @@
                                     <div class="gov-name" th:attr="title=${item.renewName}" th:text="${#strings.length(item.renewName) > 20}
                   ? ${#strings.substring(item.renewName, 0, 20) + '...'}
                   : ${item.renewName}"></div>
-                                    <div class="click-num" th:text="${item.renewCount}"><span
+                                    <div class="click-num" th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).tenThousandFormatCount(item.renewCount)}"><span
                                             class="font-small-size">条</span></div>
                                 </li>
                             </ul>

+ 2 - 2
ruoyi-admin/src/main/resources/templates/dailyVisits.html

@@ -37,7 +37,7 @@
                                     <div class="gov-name" th:attr="title=${item.accessName}" th:text="${#strings.length(item.accessName) > 20}
                   ? ${#strings.substring(item.accessName, 0, 20) + '...'}
                   : ${item.accessName}"></div>
-                                    <div class="click-num" th:text="${item.browseCount}"></div>
+                                    <div class="click-num" th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).tenThousandFormatCount(item.browseCount)}"></div>
                                 </li>
                             </ul>
                         </div>
@@ -50,7 +50,7 @@
                                     <div class="gov-name" th:attr="title=${item.accessName}" th:text="${#strings.length(item.accessName) > 20}
                   ? ${#strings.substring(item.accessName, 0, 20) + '...'}
                   : ${item.accessName}"></div>
-                                    <div class="click-num" th:text="${item.browseCount}"></div>
+                                    <div class="click-num" th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).tenThousandFormatCount(item.browseCount)}"></div>
                                 </li>
                             </ul>
                         </div>

+ 2 - 2
ruoyi-admin/src/main/resources/templates/misunderstanding.html

@@ -33,7 +33,7 @@
                         <div class="w50"><span th:attr="title=${item.misprintName}" th:text="${#strings.length(item.misprintName) > 20}
                   ? ${#strings.substring(item.misprintName, 0, 20) + '...'}
                   : ${item.misprintName}"></span></div>
-                        <div class="w25"><span th:text="${item.misprintCount}"></span></div>
+                        <div class="w25"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.misprintCount)}"></span></div>
                         <img class="table-triangle-top" th:src="@{img/triangle.png}">
                         <img class="table-triangle-btm" th:src="@{img/triangle.png}">
                     </li>
@@ -52,7 +52,7 @@
                         <div class="w50"><span th:attr="title=${item.misprintName}" th:text="${#strings.length(item.misprintName) > 20}
                   ? ${#strings.substring(item.misprintName, 0, 20) + '...'}
                   : ${item.misprintName}"></span></div>
-                        <div class="w25"><span th:text="${item.misprintCount}"></span></div>
+                        <div class="w25"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.misprintCount)}"></span></div>
                     <img class="table-triangle-top" th:src="@{img/triangle.png}">
                     <img class="table-triangle-btm" th:src="@{img/triangle.png}">
                   </li>

+ 3 - 3
ruoyi-admin/src/main/resources/templates/staggeredChain.html

@@ -33,9 +33,9 @@
                             <div class="w50"><span th:attr="title=${item.siteName}" th:text="${#strings.length(item.siteName) > 20}
                   ? ${#strings.substring(item.siteName, 0, 20) + '...'}
                   : ${item.siteName}"></span></div>
-                            <div class="w15"><span th:text="${item.errorCount}"></span></div>
-                            <div class="w15"><span th:text="${item.maliciousCount}"></span></div>
-                            <div class="w15"><span th:text="${item.gambleCount}"></span></div>
+                            <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.errorCount)}"></span></div>
+                            <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.maliciousCount)}"></span></div>
+                            <div class="w15"><span th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.gambleCount)}"></span></div>
                             <img class="table-triangle-top" th:src="@{img/triangle.png}">
                             <img class="table-triangle-btm" th:src="@{img/triangle.png}">
                         </li>

+ 1 - 1
ruoyi-admin/src/main/resources/templates/usability.html

@@ -78,7 +78,7 @@
                   ? ${#strings.substring(item.siteName, 0, 20) + '...'}
                   : ${item.siteName}"></span></div>
                             <div class="w25"><span class="h-span" th:text="${item.lastMonitorTime}"></span></div>
-                            <div class="w25"><span class="h-span" th:text="${item.accessCountFail}"></span></div>
+                            <div class="w25"><span class="h-span" th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.accessCountFail)}"></span></div>
                             <img class="table-triangle-top" th:src="@{img/triangle.png}">
                             <img class="table-triangle-btm" th:src="@{img/triangle.png}">
                         </li>

+ 1 - 1
ruoyi-admin/src/main/resources/templates/websiteAccess.html

@@ -54,7 +54,7 @@
                             <div class="list-text" th:attr="title=${item.informationName}" th:text="${#strings.length(item.informationName) > 20}
                   ? ${#strings.substring(item.informationName, 0, 20) + '...'}
                   : ${item.informationName}"></div>
-                            <div class="list-click-num" th:text="${item.popularBrowse}"></div>
+                            <div class="list-click-num" th:text="${T(com.ruoyi.web.controller.tool.NumberUtils).thousandFormatCount(item.popularBrowse)}"></div>
                         </div>
                     </div>
                 </div>