Files
张翔 b0f91d74f5 feat: 统一JWT密钥配置并修复签名验证问题
修复前端签名生成中bodyString硬编码问题
添加start-frontend.sh脚本启动前端服务
统一manage-app和gateway的JWT密钥配置
修复Repository扫描路径问题
更新测试配置和依赖
重构表名映射为sys_user和sys_role
完善用户实体类字段映射
添加集成测试配置和测试用例
2026-04-02 12:28:49 +08:00

82 lines
3.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""
检查Service层命名规范
"""
import os
import re
from pathlib import Path
def check_service_naming():
"""检查Service层命名规范"""
base_path = Path("/Users/zhangxiang/Codes/Novalon/novalon-manage-system/novalon-manage-api/manage-sys/src/main/java")
print("=" * 60)
print("Service层命名规范检查")
print("=" * 60)
# 查找所有Service接口
service_interfaces = []
for java_file in base_path.rglob("*Service.java"):
content = java_file.read_text()
if f"interface I" in content or re.search(r'interface\s+I\w+Service', content):
service_interfaces.append(java_file)
print(f"\n找到 {len(service_interfaces)} 个Service接口:")
for interface in sorted(service_interfaces):
interface_name = interface.stem
print(f"{interface_name}")
# 查找所有Service实现类
service_impls = []
for java_file in base_path.rglob("*Service*.java"):
if "impl" in str(java_file) or "handler" in str(java_file):
content = java_file.read_text()
if "class" in content and "Service" in content:
service_impls.append(java_file)
print(f"\n找到 {len(service_impls)} 个Service实现类:")
issues = []
for impl in sorted(service_impls):
impl_name = impl.stem
content = impl.read_text()
# 检查是否实现了接口
implements_match = re.search(r'implements\s+(\w+)', content)
if implements_match:
interface_name = implements_match.group(1)
# 检查命名规范
if interface_name.startswith('I'):
expected_impl_name = interface_name[1:] # 移除I前缀
# 特殊情况:ExceptionLogServiceImpl是适配器
if impl_name == "ExceptionLogServiceImpl":
print(f"{impl_name} (适配器类)")
elif impl_name == expected_impl_name:
print(f"{impl_name} implements {interface_name}")
else:
print(f" ⚠️ {impl_name} implements {interface_name}")
print(f" 建议重命名为: {expected_impl_name}")
issues.append((impl, impl_name, expected_impl_name))
else:
print(f" {impl_name} implements {interface_name} (非标准接口)")
else:
print(f"{impl_name} (未找到implements关键字)")
# 检查是否有不符合规范的命名
print("\n" + "=" * 60)
if issues:
print(f"发现 {len(issues)} 个命名不规范的问题:")
for impl, current_name, expected_name in issues:
print(f" - {current_name} -> {expected_name}")
print(f" 文件: {impl}")
else:
print("✅ 所有Service命名都符合规范!")
print("=" * 60)
if __name__ == "__main__":
check_service_naming()