From edbfa6b1a3a45e79cb17b06f3798535c3b1ba395 Mon Sep 17 00:00:00 2001
From: yxh <172933527@qq.com>
Date: 星期三, 18 十一月 2026 09:12:39 +0800
Subject: [PATCH] 修改了增值税城建税

---
 ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java |   78 ++++++++++++++++++++++++++++++++++----
 1 files changed, 69 insertions(+), 9 deletions(-)

diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java b/ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java
index d3508f3..1dfdb42 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/common/AttachmentNameValidator.java
@@ -39,11 +39,17 @@
     public static final String MSG_TOO_LONG = "涓烘柟渚挎煡楠岄檮浠讹紝闄勪欢鍚嶅瓧闀垮害涓嶈兘瓒呰繃20涓瓧锛�";
     public static final String MSG_ILLEGAL = "涓烘柟渚挎煡楠岄檮浠讹紝闄勪欢鍚嶄笉鑳藉寘鍚┖鏍煎強 / \\ : * ? \" < > | # % 绛夌壒娈婂瓧绗︼紒";
     public static final String MSG_DUPLICATE = "涓烘柟渚挎煡楠岄檮浠讹紝鍚屼竴琛屽唴涓嶈兘鏈夐噸鍚嶇殑闄勪欢锛�";
+    /** 2026-11-17锛氶潪涓撳璐�/浼︾悊涓撳璐圭殑鎶ラ攢鍗曪紝闄勪欢鍚嶅繀椤诲惈涓枃 */
+    public static final String MSG_NEED_CHINESE =
+            "闄勪欢鍚嶄笉绗﹀悎鍖婚櫌鎶ラ攢鍗曞鎵硅姹傦細鍚嶇О椤诲弽鏄犲彂绁ㄤ富瑕佸唴瀹癸紙闇�鍖呭惈涓枃锛夛紝濡俓"2026骞�10鏈堜綇闄㈣垂\"";
     /** 闄勪欢椤归噷鍙栦笉鍒颁换浣曟枃浠跺悕锛堟棦娌℃湁 name 涔熸病鏈� fileName锛夋椂鐨勬彁绀� */
     public static final String MSG_NO_NAME = "涓烘柟渚挎煡楠岄檮浠讹紝闄勪欢蹇呴』甯︽枃浠跺悕锛岃閲嶆柊涓婁紶锛�";
 
     /** 闈炴硶瀛楃锛氱┖鏍硷紙鍚悇绫荤┖鐧斤級+ / \ : * ? " < > | # % */
     private static final Pattern ILLEGAL = Pattern.compile("[\\s/\\\\:*?\"<>|#%]");
+
+    /** 涓枃鍖归厤锛堜富骞叉槸鍚﹀惈涓枃锛� */
+    private static final Pattern CHINESE = Pattern.compile("[\\u4e00-\\u9fa5]");
 
     private static final ObjectMapper MAPPER = new ObjectMapper();
 
@@ -60,12 +66,23 @@
     }
 
     /**
-     * 鏍¢獙鍗曚釜鏂囦欢鍚嶃��
+     * 鏍¢獙鍗曚釜鏂囦欢鍚嶏紙涓嶈姹傚惈涓枃锛屽吋瀹规棫璋冪敤锛夈��
      *
      * @param fileName 鍘熷鏂囦欢鍚�
      * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜
      */
     public static String checkName(String fileName) {
+        return checkName(fileName, false);
+    }
+
+    /**
+     * 鏍¢獙鍗曚釜鏂囦欢鍚嶃��
+     *
+     * @param fileName       鍘熷鏂囦欢鍚�
+     * @param requireChinese {@code true}=涓诲共蹇呴』鍚腑鏂囷紙闈炰笓瀹惰垂/浼︾悊涓撳璐圭殑鎶ラ攢鍗曪級
+     * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜
+     */
+    public static String checkName(String fileName, boolean requireChinese) {
         String name = fileName == null ? "" : fileName.trim();
         if (name.isEmpty()) {
             return MSG_EMPTY_NAME;
@@ -74,7 +91,10 @@
             return MSG_ILLEGAL;
         }
         String main = mainName(name);
-        // 涓嶅啀寮哄埗瑕佹眰涓枃锛涘惈涓枃銆佺函鑻辨枃銆佹暟瀛楀潎鍙�
+        // 2026-11-17锛氶潪涓撳璐�/浼︾悊涓撳璐圭殑鎶ラ攢鍗曪紝闄勪欢鍚嶄富骞插繀椤诲惈涓枃
+        if (requireChinese && !CHINESE.matcher(main).find()) {
+            return MSG_NEED_CHINESE;
+        }
         // 鎸夊瓧绗︽暟璁★紙鐮佺偣璁℃暟锛氫腑鏂�/瀛楁瘝/鏁板瓧/鍏ㄨ鍚勮 1锛�
         if (main.codePointCount(0, main.length()) > MAX_MAIN_LENGTH) {
             return MSG_TOO_LONG;
@@ -89,7 +109,18 @@
      * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜锛堝惈鏂囦欢鍚嶏級
      */
     public static String checkJson(String json) {
-        return checkJson(json, null, true);
+        return checkJson(json, null, true, false);
+    }
+
+    /**
+     * 鏍¢獙涓�涓檮浠跺垪琛� JSON锛堝彲鎸囧畾鏄惁蹇呴』鍚腑鏂囷級銆�
+     *
+     * @param json           闄勪欢瀛楁鍐呭锛坅nnexfiles / invoicefiles锛夛紝鍙负绌�
+     * @param requireChinese {@code true}=鏂囦欢鍚嶄富骞插繀椤诲惈涓枃
+     * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜锛堝惈鏂囦欢鍚嶏級
+     */
+    public static String checkJson(String json, boolean requireChinese) {
+        return checkJson(json, null, true, requireChinese);
     }
 
     /**
@@ -102,7 +133,14 @@
      *                      闇�涓哄皬鍐欏幓绌虹櫧褰㈠紡锛涗负绌�/涓� null 琛ㄧず鎸夊叏鏂板崟鎹鐞嗭級
      */
     public static String checkJsonForUpdate(String json, Set<String> existingNames) {
-        return checkJson(json, existingNames, false);
+        return checkJson(json, existingNames, false, false);
+    }
+
+    /**
+     * 淇敼淇濆瓨鏃朵娇鐢紙鍙寚瀹氭槸鍚﹀繀椤诲惈涓枃锛夛紝蹇界暐"淇濆瓨鍓嶅凡瀛樺湪"鐨勫巻鍙查檮浠跺悕銆�
+     */
+    public static String checkJsonForUpdate(String json, Set<String> existingNames, boolean requireChinese) {
+        return checkJson(json, existingNames, false, requireChinese);
     }
 
     /**
@@ -135,8 +173,10 @@
     /**
      * @param existingNames 鍘嗗彶闄勪欢鍚嶏紙灏忓啓锛夛紝鍛戒腑鍒欒烦杩囨牎楠岋紱{@code null} 琛ㄧず涓嶅拷鐣ヤ换浣曞悕瀛�
      * @param strictNoName  {@code true}=鍙栦笉鍒版枃浠跺悕鏃舵嫤鎴紙鍏ㄦ柊淇濆瓨锛夛紱{@code false}=鏀捐锛堜慨鏀瑰巻鍙插崟鎹級
+     * @param requireChinese {@code true}=鏂囦欢鍚嶄富骞插繀椤诲惈涓枃锛堥潪涓撳璐�/浼︾悊涓撳璐圭殑鎶ラ攢鍗曪級
      */
-    private static String checkJson(String json, Set<String> existingNames, boolean strictNoName) {
+    private static String checkJson(String json, Set<String> existingNames, boolean strictNoName,
+                                    boolean requireChinese) {
         if (json == null || json.trim().isEmpty()) {
             return null;
         }
@@ -175,7 +215,7 @@
                 // 鍘嗗彶闄勪欢锛堜繚瀛樺墠宸插瓨鍦級涓嶅弬涓庢牎楠岋細涓氬姟纭"鍙牎楠屾湰娆″彉鏇寸殑闄勪欢"锛岄伩鍏嶅崱浣忚�佸崟鎹�
                 continue;
             }
-            String reason = checkName(name);
+            String reason = checkName(name, requireChinese);
             if (reason != null) {
                 return "銆�" + name + "銆�" + reason;
             }
@@ -214,11 +254,24 @@
      * @param jsons 闄勪欢瀛楁鍐呭锛屽彲涓� null/绌�
      * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜
      */
-    public static String checkJsonList(String... jsons) {        if (jsons == null) {
+    public static String checkJsonList(String... jsons) {
+        return checkJsonList(false, jsons);
+    }
+
+    /**
+     * 鏍¢獙鍚屼竴鏄庣粏琛屼笅鐨勫涓檮浠跺垪琛紙鍙寚瀹氭槸鍚﹀繀椤诲惈涓枃锛夛紝閫愪釜鍒楄〃鐙珛鏍¢獙锛�
+     * 姣忎釜鍒楄〃鍐呴儴鏌ラ噸鍚嶏紙涓庡墠绔� checkDetails 鐨勫彛寰勪竴鑷达級銆�
+     *
+     * @param requireChinese {@code true}=鏂囦欢鍚嶄富骞插繀椤诲惈涓枃
+     * @param jsons          闄勪欢瀛楁鍐呭锛屽彲涓� null/绌�
+     * @return {@code null}=閫氳繃锛涘惁鍒欒繑鍥炰笉鍚堟牸鍘熷洜
+     */
+    public static String checkJsonList(boolean requireChinese, String... jsons) {
+        if (jsons == null) {
             return null;
         }
         for (String json : jsons) {
-            String reason = checkJson(json);
+            String reason = checkJson(json, requireChinese);
             if (reason != null) {
                 return reason;
             }
@@ -228,11 +281,18 @@
 
     /** 淇敼淇濆瓨鏃朵娇鐢細蹇界暐鍘嗗彶闄勪欢鍚嶏紝閫愪釜鍒楄〃鏍¢獙锛堜緵"澶氫釜瀛楁涓�璧锋牎楠�"鐨勮皟鐢ㄧ偣锛� */
     public static String checkJsonListForUpdate(Set<String> existingNames, String... jsons) {
+        return checkJsonListForUpdate(existingNames, false, jsons);
+    }
+
+    /**
+     * 淇敼淇濆瓨鏃朵娇鐢紙鍙寚瀹氭槸鍚﹀繀椤诲惈涓枃锛夛細蹇界暐鍘嗗彶闄勪欢鍚嶏紝閫愪釜鍒楄〃鏍¢獙銆�
+     */
+    public static String checkJsonListForUpdate(Set<String> existingNames, boolean requireChinese, String... jsons) {
         if (jsons == null) {
             return null;
         }
         for (String json : jsons) {
-            String reason = checkJsonForUpdate(json, existingNames);
+            String reason = checkJsonForUpdate(json, existingNames, requireChinese);
             if (reason != null) {
                 return reason;
             }

--
Gitblit v1.9.3