2
0

feat: i18n support for export and log

This commit is contained in:
zhangsz
2025-02-11 18:21:13 +08:00
parent 0fdf23fa16
commit 1a5bf3461f
27 changed files with 340 additions and 118 deletions

View File

@@ -27,6 +27,11 @@ public @interface Excel
* 导出到Excel中的名字.
*/
public String name() default "";
/**
* Whether to use localized name from message resource bundle
*/
public boolean useLocalized() default true;
/**
* 日期格式, 如: yyyy-MM-dd

View File

@@ -59,6 +59,7 @@ import org.wfc.common.core.annotation.Excels;
import org.wfc.common.core.exception.UtilException;
import org.wfc.common.core.text.Convert;
import org.wfc.common.core.utils.DateUtils;
import org.wfc.common.core.utils.MessageUtils;
import org.wfc.common.core.utils.StringUtils;
import org.wfc.common.core.utils.file.FileTypeUtils;
import org.wfc.common.core.utils.file.ImageUtils;
@@ -218,6 +219,19 @@ public class ExcelUtil<T>
createSubHead();
}
/**
* Gets the localized name for an Excel annotation
* @param excel The Excel annotation
* @return The localized name if useLocalized is true and name is a valid message key,
* otherwise returns the original name
*/
public static String getLocalizedName(Excel excel) {
if (!excel.useLocalized() || excel.name() == null || excel.name().isEmpty()) {
return excel.name();
}
return MessageUtils.message(excel.name());
}
/**
* 创建excel第一行标题
*/
@@ -819,7 +833,8 @@ public class ExcelUtil<T>
// 创建列
Cell cell = row.createCell(column);
// 写入列信息
cell.setCellValue(attr.name());
// cell.setCellValue(attr.name());
cell.setCellValue(getLocalizedName(attr));
setDataValidation(attr, row, column);
cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor())));
if (isSubList())

View File

@@ -177,10 +177,14 @@ common.demo.mode=Demo mode, no operation is allowed
menu.system.management=System Management
menu.system.config=System Config
menu.system.dict.management=Dict Management
menu.system.dict.type=Dict Type
menu.system.dict.data=Dict Data
menu.system.menu.management=Menu Management
menu.system.role.management=Role Management
menu.system.role.data=Role Data
menu.system.account.management=Account Management
menu.system.job.management=Job Management
menu.system.job.management=Task Management
menu.system.job.log=Task Log
menu.system.file.management=File Management
menu.system.config.management=Config Management
menu.system.log.management=Log Management
@@ -194,7 +198,7 @@ menu.system.tenant.role.management=Tenant Role Management
menu.system.tenant.menu.management=Tenant Menu Management
menu.system.tenant.dict.management=Tenant Dict Management
menu.system.tenant.config.management=Tenant Config Management
menu.system.tenant.job.management=Tenant Job Management
menu.system.tenant.job.management=Tenant Task Management
menu.system.tenant.file.management=Tenant File Management
menu.system.tenant.log.management=Tenant Log Management
menu.system.tenant.monitor.management=Tenant Monitor Management
@@ -203,7 +207,12 @@ menu.billing.rule.management=Billing Rule
menu.billing.ratelimit.management=Rate Limit
menu.billing.package.management=Package Management
menu.user.management=User Management
menu.user.data=User Data
menu.user.online=User Online
menu.user.info=User Information
menu.user.password=User Password
menu.user.profile=User Profile
menu.user.avatar=User Avatar
menu.user.cdr.management=Internet Record
menu.user.bill.management=Bill Management
menu.user.kyc.management=KYC Management
@@ -263,3 +272,51 @@ menu.action.task.export=Export Task
menu.action.batch.export=Batch Export
menu.action.batch.import=Batch Import
menu.action.batch.delete=Batch Delete
# excel export eperation log
excel.operation.log=Operation Log
excel.operation.log.id=Log ID
excel.operation.log.title=Module Title
excel.operation.log.business.type=Business Type
excel.operation.log.method=Method
excel.operation.log.request.method=Request Method
excel.operation.log.operator.type=Operator Type
excel.operation.log.operator.name=Operator
excel.operation.log.department.name=Department name
excel.operation.log.operation.url=Operation URL
excel.operation.log.operation.ip=Operation IP
excel.operation.log.operation.parameter=Operation Parameter
excel.operation.log.json.result=Result
excel.operation.log.status=Status
excel.operation.log.error.msg=Error Message
excel.operation.log.operation.time=Operation Time
excel.operation.log.cost.time=Cost Time
# excel export task
excel.scheduled.task.list=Task List
excel.scheduled.task.id=Task ID
excel.scheduled.task.name=Task Name
excel.scheduled.task.job.group=Task Group
excel.scheduled.task.invoke.target=Invoke Target
excel.scheduled.task.cron.expression=Cron Expression
excel.scheduled.task.schedule.strategy=Schedule Strategy
excel.scheduled.task.concurrent=Concurrent
excel.scheduled.task.status=Task Status
excel.scheduled.task.create.time=Create Time
excel.scheduled.task.update.time=Update Time
excel.scheduled.task.remark=Remark
excel.scheduled.task.log.id=Log ID
excel.scheduled.task.log.info=Log Info
excel.scheduled.task.log.status=Status
excel.scheduled.task.log.error.msg=Error Message
# excel export dict data
excel.dict.data=Dict Data
excel.dict.data.dict.code=Dict Code
excel.dict.data.dict.sort=Dict Sort
excel.dict.data.dict.label=Dict Label
excel.dict.data.dict.value=Dict Value
excel.dict.data.dict.type=Dict Type
excel.dict.data.is.default=Is Default
excel.dict.data.status=Status
excel.dict.data.remark=Remark

View File

@@ -179,10 +179,14 @@ common.demo.mode=Demo mode, no operation is allowed
menu.system.management=System Management
menu.system.config=System Config
menu.system.dict.management=Dict Management
menu.system.dict.type=Dict Type
menu.system.dict.data=Dict Data
menu.system.menu.management=Menu Management
menu.system.role.management=Role Management
menu.system.role.data=Role Data
menu.system.account.management=Account Management
menu.system.job.management=Job Management
menu.system.job.management=Task Management
menu.system.job.log=Task Log
menu.system.file.management=File Management
menu.system.config.management=Config Management
menu.system.log.management=Log Management
@@ -196,7 +200,7 @@ menu.system.tenant.role.management=Tenant Role Management
menu.system.tenant.menu.management=Tenant Menu Management
menu.system.tenant.dict.management=Tenant Dict Management
menu.system.tenant.config.management=Tenant Config Management
menu.system.tenant.job.management=Tenant Job Management
menu.system.tenant.job.management=Tenant Task Management
menu.system.tenant.file.management=Tenant File Management
menu.system.tenant.log.management=Tenant Log Management
menu.system.tenant.monitor.management=Tenant Monitor Management
@@ -205,7 +209,12 @@ menu.billing.rule.management=Billing Rule
menu.billing.ratelimit.management=Rate Limit
menu.billing.package.management=Package Management
menu.user.management=User Management
menu.user.data=User Data
menu.user.online=User Online
menu.user.info=User Information
menu.user.password=User Password
menu.user.profile=User Profile
menu.user.avatar=User Avatar
menu.user.cdr.management=Internet Record
menu.user.bill.management=Bill Management
menu.user.kyc.management=KYC Management
@@ -265,3 +274,51 @@ menu.action.task.export=Export Task
menu.action.batch.export=Batch Export
menu.action.batch.import=Batch Import
menu.action.batch.delete=Batch Delete
# excel export eperation log
excel.operation.log=Operation Log
excel.operation.log.id=Log ID
excel.operation.log.title=Module Title
excel.operation.log.business.type=Business Type
excel.operation.log.method=Method
excel.operation.log.request.method=Request Method
excel.operation.log.operator.type=Operator Type
excel.operation.log.operator.name=Operator
excel.operation.log.department.name=Department name
excel.operation.log.operation.url=Operation URL
excel.operation.log.operation.ip=Operation IP
excel.operation.log.operation.parameter=Operation Parameter
excel.operation.log.json.result=Result
excel.operation.log.status=Status
excel.operation.log.error.msg=Error Message
excel.operation.log.operation.time=Operation Time
excel.operation.log.cost.time=Cost Time
# excel export task
excel.scheduled.task.list=Task List
excel.scheduled.task.id=Task ID
excel.scheduled.task.name=Task Name
excel.scheduled.task.job.group=Task Group
excel.scheduled.task.invoke.target=Invoke Target
excel.scheduled.task.cron.expression=Cron Expression
excel.scheduled.task.schedule.strategy=Schedule Strategy
excel.scheduled.task.concurrent=Concurrent
excel.scheduled.task.status=Task Status
excel.scheduled.task.create.time=Create Time
excel.scheduled.task.update.time=Update Time
excel.scheduled.task.remark=Remark
excel.scheduled.task.log.id=Log ID
excel.scheduled.task.log.info=Log Info
excel.scheduled.task.log.status=Status
excel.scheduled.task.log.error.msg=Error Message
# excel export dict data
excel.dict.data=Dict Data
excel.dict.data.dict.code=Dict Code
excel.dict.data.dict.sort=Dict Sort
excel.dict.data.dict.label=Dict Label
excel.dict.data.dict.value=Dict Value
excel.dict.data.dict.type=Dict Type
excel.dict.data.is.default=Is Default
excel.dict.data.status=Status
excel.dict.data.remark=Remark

View File

@@ -181,10 +181,14 @@ common.demo.mode=演示模式,不允许操作
menu.system.management=系统管理
menu.system.config=系统配置
menu.system.dict.management=字典管理
menu.system.dict.type=字典类型
menu.system.dict.data=字典数据
menu.system.menu.management=菜单管理
menu.system.role.management=角色管理
menu.system.role.data=角色数据
menu.system.account.management=账号管理
menu.system.job.management=任务管理
menu.system.job.log=任务日志
menu.system.file.management=文件管理
menu.system.config.management=参数管理
menu.system.log.management=日志管理
@@ -208,7 +212,12 @@ menu.billing.ratelimit.management=限速设置
menu.billing.package.management=套餐管理
menu.billing.payment.setting=支付设置
menu.user.management=用户管理
menu.user.data=角色数据
menu.user.online=在线用户
menu.user.info=用户信息
menu.user.password=用户密码
menu.user.profile=个人信息
menu.user.avatar=用户头像
menu.user.account.management=账号管理
menu.user.cdr.management=话单管理
menu.user.bill.management=账单管理
@@ -270,3 +279,51 @@ menu.action.task.export=任务导出
menu.action.batch.export=批量导出
menu.action.batch.import=批量导入
menu.action.batch.delete=批量删除
# excel export operation log
excel.operation.log=操作日志
excel.operation.log.id=日志序号
excel.operation.log.title=模块标题
excel.operation.log.business.type=业务类型
excel.operation.log.method=请求方法
excel.operation.log.request.method=请求方式
excel.operation.log.operator.type=操作类别
excel.operation.log.operator.name=操作人员
excel.operation.log.department.name=部门名称
excel.operation.log.operation.url=请求地址
excel.operation.log.operation.ip=操作地址
excel.operation.log.operation.parameter=请求参数
excel.operation.log.json.result=返回参数
excel.operation.log.status=状态
excel.operation.log.error.msg=错误消息
excel.operation.log.operation.time=操作时间
excel.operation.log.cost.time=消耗时间
# excel export job
excel.scheduled.task.list=任务列表
excel.scheduled.task.id=任务序号
excel.scheduled.task.name=任务名称
excel.scheduled.task.job.group=任务组名
excel.scheduled.task.invoke.target=调用目标字符串
excel.scheduled.task.cron.expression=执行表达式
excel.scheduled.task.schedule.strategy=计划策略
excel.scheduled.task.concurrent=并发执行
excel.scheduled.task.status=任务状态
excel.scheduled.task.create.time=创建时间
excel.scheduled.task.update.time=更新时间
excel.scheduled.task.remark=备注
excel.scheduled.task.log.id=日志序号
excel.scheduled.task.log.info=日志信息
excel.scheduled.task.log.status=执行状态
excel.scheduled.task.log.error.msg=异常信息
# excel export dict data
excel.dict.data=字典数据
excel.dict.data.dict.code=数据编号
excel.dict.data.dict.sort=字典排序
excel.dict.data.dict.label=字典标签
excel.dict.data.dict.value=字典键值
excel.dict.data.dict.type=字典类型
excel.dict.data.is.default=是否默认
excel.dict.data.status=状态
excel.dict.data.remark=备注