This commit is contained in:
devezhao 2021-05-21 00:09:52 +08:00
parent 8ad5fd72ed
commit 309b7237cc
172 changed files with 1305 additions and 1426 deletions

2
@rbv

@ -1 +1 @@
Subproject commit 47b6d0b22f0f6e1bdd3cd0439deba63a69f5a7c4
Subproject commit 825fdd4e0db7ebbf7f89276d3ba97ea615742d1b

View file

@ -14,8 +14,6 @@ import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.JSONable;
import lombok.Data;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 统一请求返回消息体
*
@ -86,13 +84,13 @@ public class RespBody implements JSONable {
public static RespBody error(String errorMsg, int errorCode) {
if (errorMsg == null) {
if (errorCode == 401) {
errorMsg = $L("未授权访问");
errorMsg = Language.L("未授权访问");
} else if (errorCode == 403) {
errorMsg = $L("权限不足,访问被阻止");
errorMsg = Language.L("权限不足,访问被阻止");
} else if (errorCode == 404) {
errorMsg = $L("访问的页面/资源不存在");
errorMsg = Language.L("访问的页面/资源不存在");
} else {
errorMsg = $L("系统繁忙,请稍后重试");
errorMsg = Language.L("系统繁忙,请稍后重试");
}
}
return new RespBody(errorCode, errorMsg, null);
@ -102,10 +100,10 @@ public class RespBody implements JSONable {
* @param errorMsg
* @param placeholders
* @return
* @see Language#$L(String, Object...)
* @see Language#L(String, Object...)
*/
public static RespBody errorl(String errorMsg, Object... placeholders) {
return error($L(errorMsg, placeholders), Controller.CODE_ERROR);
return error(Language.L(errorMsg, placeholders), Controller.CODE_ERROR);
}
/**
@ -120,6 +118,6 @@ public class RespBody implements JSONable {
* @return
*/
public static RespBody ok(Object data) {
return new RespBody(Controller.CODE_OK, $L("调用成功"), data);
return new RespBody(Controller.CODE_OK, Language.L("调用成功"), data);
}
}

View file

@ -16,11 +16,10 @@ import com.rebuild.core.Application;
import com.rebuild.core.privileges.bizz.User;
import com.rebuild.core.privileges.bizz.ZeroEntry;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.RateLimiters;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 获取登录 Token 可用于单点登录
*
@ -35,7 +34,7 @@ public class LoginToken extends BaseApi {
String password = context.getParameterNotBlank("password");
if (RateLimiters.RRL_LOGIN.overLimitWhenIncremented("user:" + user)) {
return formatFailure($L("请求过于频繁,请稍后重试"), ApiInvokeException.ERR_FREQUENCY);
return formatFailure(Language.L("请求过于频繁,请稍后重试"), ApiInvokeException.ERR_FREQUENCY);
}
String hasError = checkUser(user, password);
@ -63,13 +62,13 @@ public class LoginToken extends BaseApi {
*/
public static String checkUser(String user, String password) {
if (!Application.getUserStore().existsUser(user)) {
return $L("用户名或密码错误");
return Language.L("用户名或密码错误");
}
User loginUser = Application.getUserStore().getUser(user);
if (!loginUser.isActive()
|| !Application.getPrivilegesManager().allow(loginUser.getId(), ZeroEntry.AllowLogin)) {
return $L("用户未激活或不允许登录");
return Language.L("用户未激活或不允许登录");
}
Object[] foundUser = Application.createQueryNoFilter(
@ -81,7 +80,7 @@ public class LoginToken extends BaseApi {
// Okay
return null;
} else {
return $L("用户名或密码错误");
return Language.L("用户名或密码错误");
}
}
}

View file

@ -14,8 +14,7 @@ import com.rebuild.core.UserContextHolder;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.service.BaseService;
import com.rebuild.core.service.DataSpecificationException;
import static com.rebuild.core.support.i18n.Language.$L;
import com.rebuild.core.support.i18n.Language;
/**
* 配置类的 Service在增//改时调用清理缓存方法
@ -59,7 +58,7 @@ public abstract class BaseConfigurationService extends BaseService {
if (UserHelper.isAdmin(user)) return;
if (!UserHelper.isSelf(user, cfgid)) {
throw new DataSpecificationException($L("无权操作他人配置"));
throw new DataSpecificationException(Language.L("无权操作他人配置"));
}
}

View file

@ -22,6 +22,7 @@ import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.privileges.UserService;
import com.rebuild.core.service.project.ProjectManager;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.AppUtils;
import com.rebuild.utils.JSONUtils;
import lombok.extern.slf4j.Slf4j;
@ -33,8 +34,6 @@ import org.jsoup.nodes.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.Iterator;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 导航渲染
*
@ -56,15 +55,15 @@ public class NavBuilder extends NavManager {
private static final JSONArray NAVS_DEFAULT = JSONUtils.toJSONObjectArray(
NAV_ITEM_PROPS,
new Object[][] {
new Object[] { "chart-donut", $L("动态"), "BUILTIN", NAV_FEEDS },
new Object[] { "shape", $L("项目"), "BUILTIN", NAV_PROJECT },
new Object[] { "folder", $L("文件"), "BUILTIN", NAV_FILEMRG }
new Object[] { "chart-donut", Language.L("动态"), "BUILTIN", NAV_FEEDS },
new Object[] { "shape", Language.L("项目"), "BUILTIN", NAV_PROJECT },
new Object[] { "folder", Language.L("文件"), "BUILTIN", NAV_FILEMRG }
});
// 新建项目
private static final JSONObject NAV_PROJECT__ADD = JSONUtils.toJSONObject(
NAV_ITEM_PROPS,
new String[] { "plus", $L("添加项目"), "BUILTIN", NAV_PROJECT + "--add" }
new String[] { "plus", Language.L("添加项目"), "BUILTIN", NAV_PROJECT + "--add" }
);
// URL 绑定实体权限

View file

@ -19,11 +19,10 @@ import com.rebuild.core.privileges.AdminGuard;
import com.rebuild.core.privileges.UserService;
import com.rebuild.core.service.DataSpecificationException;
import com.rebuild.core.service.general.QuickCodeReindexTask;
import com.rebuild.core.support.i18n.Language;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 分类数据
*
@ -51,7 +50,7 @@ public class ClassificationService extends BaseConfigurationService implements A
for (Object[] o : used) {
if (StringUtils.contains((String) o[0], recordId.toLiteral())) {
String usedEntity = EasyMetaFactory.getLabel((String) o[1]);
throw new DataSpecificationException($L("此分类数据正在被 **%s** 使用,不能删除", usedEntity));
throw new DataSpecificationException(Language.L("此分类数据正在被 **%s** 使用,不能删除", usedEntity));
}
}

View file

@ -29,6 +29,7 @@ import com.rebuild.core.service.NoRecordFoundException;
import com.rebuild.core.service.approval.ApprovalState;
import com.rebuild.core.service.approval.RobotApprovalManager;
import com.rebuild.core.support.general.FieldValueHelper;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.state.StateManager;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@ -36,8 +37,6 @@ import org.springframework.util.Assert;
import java.util.*;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 表单构造
*
@ -117,17 +116,17 @@ public class FormsBuilder extends FormsManager {
if ((approvalState == ApprovalState.PROCESSING || approvalState == ApprovalState.APPROVED)) {
return formatModelError(approvalState == ApprovalState.APPROVED
? $L("主记录已完成审批,不能添加明细") : $L("主记录正在审批中,不能添加明细"));
? Language.L("主记录已完成审批,不能添加明细") : Language.L("主记录正在审批中,不能添加明细"));
}
// 明细无需审批
approvalState = null;
if (!Application.getPrivilegesManager().allowUpdate(user, mainId)) {
return formatModelError($L("你没有添加明细权限"));
return formatModelError(Language.L("你没有添加明细权限"));
}
} else if (!Application.getPrivilegesManager().allowCreate(user, entityMeta.getEntityCode())) {
return formatModelError($L("你没有新建权限" ));
return formatModelError(Language.L("你没有新建权限" ));
} else {
approvalState = getHadApproval(entityMeta, null);
}
@ -135,7 +134,7 @@ public class FormsBuilder extends FormsManager {
// 查看视图
else if (viewMode) {
if (!Application.getPrivilegesManager().allowRead(user, record)) {
return formatModelError($L("无权读取此记录或记录已被删除"));
return formatModelError(Language.L("无权读取此记录或记录已被删除"));
}
approvalState = getHadApproval(entityMeta, record);
@ -144,16 +143,16 @@ public class FormsBuilder extends FormsManager {
// 编辑
else {
if (!Application.getPrivilegesManager().allowUpdate(user, record)) {
return formatModelError($L("你没有修改此记录的权限"));
return formatModelError(Language.L("你没有修改此记录的权限"));
}
approvalState = getHadApproval(entityMeta, record);
if (approvalState != null) {
String recordType = mainEntity == null ? $L("记录") : $L("主记录");
String recordType = mainEntity == null ? Language.L("记录") : Language.L("主记录");
if (approvalState == ApprovalState.APPROVED) {
return formatModelError($L("%s已完成审批禁止操作", recordType));
return formatModelError(Language.L("%s已完成审批禁止操作", recordType));
} else if (approvalState == ApprovalState.PROCESSING) {
return formatModelError($L("%s正在审批中禁止操作", recordType));
return formatModelError(Language.L("%s正在审批中禁止操作", recordType));
}
}
}
@ -161,14 +160,14 @@ public class FormsBuilder extends FormsManager {
ConfigBean model = getFormLayout(entity, user);
JSONArray elements = (JSONArray) model.getJSON("elements");
if (elements == null || elements.isEmpty()) {
return formatModelError($L("此表单布局尚未配置,请配置后使用"));
return formatModelError(Language.L("此表单布局尚未配置,请配置后使用"));
}
Record data = null;
if (record != null) {
data = findRecord(record, user, elements);
if (data == null) {
return formatModelError($L("无权读取此记录或记录已被删除"));
return formatModelError(Language.L("无权读取此记录或记录已被删除"));
}
}
@ -184,7 +183,7 @@ public class FormsBuilder extends FormsManager {
buildModelElements(elements, entityMeta, data, user, !viewMode);
if (elements.isEmpty()) {
return formatModelError($L("此表单布局尚未配置,请配置后使用"));
return formatModelError(Language.L("此表单布局尚未配置,请配置后使用"));
}
// /明细实体处理
@ -373,7 +372,7 @@ public class FormsBuilder extends FormsManager {
el.put("value", FieldValueHelper.wrapMixValue((ID) dept.getIdentity(), dept.getName()));
break;
case EntityHelper.ApprovalId:
el.put("value", FieldValueHelper.wrapMixValue(null, $L("未提交")));
el.put("value", FieldValueHelper.wrapMixValue(null, Language.L("未提交")));
break;
case EntityHelper.ApprovalState:
el.put("value", ApprovalState.DRAFT.getState());
@ -386,7 +385,7 @@ public class FormsBuilder extends FormsManager {
// 默认值
if (el.get("value") == null) {
if (dt == DisplayType.SERIES) {
el.put("value", $L("自动值"));
el.put("value", Language.L("自动值"));
} else {
Object defaultValue = easyField.exprDefaultValue();
if (defaultValue != null) {
@ -407,7 +406,7 @@ public class FormsBuilder extends FormsManager {
|| dt == DisplayType.SERIES
|| dt == DisplayType.TEXT
|| dt == DisplayType.NTEXT) {
el.put("value", $L("自动值"));
el.put("value", Language.L("自动值"));
}
}

View file

@ -20,6 +20,7 @@ import com.rebuild.core.configuration.ConfigBean;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import java.util.HashMap;
@ -27,8 +28,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 视图-相关项/新建相关
*
@ -192,7 +191,7 @@ public class ViewAddonsManager extends BaseLayoutManager {
: String.format("%s (%s)", show.getString("entityLabel"), EasyMetaFactory.getLabel(field));
show.put("entityLabel", entityLabel);
} else if (fieldEntity.getEntityCode() == EntityHelper.Feeds) {
show.put("entityLabel", $L("动态"));
show.put("entityLabel", Language.L("动态"));
}
return show;
}

View file

@ -20,8 +20,6 @@ import org.springframework.util.Assert;
import java.util.Date;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author Zhao Fangfang
* @see MetadataHelper
@ -37,14 +35,16 @@ public class EntityHelper {
public static Record parse(JSONObject data, ID user) {
JSONObject metadata = data.getJSONObject(EntityRecordCreator.META_FIELD);
if (metadata == null) {
throw new FieldValueException($L("无效实体数据格式 : %s", data.toJSONString()));
throw new FieldValueException(
com.rebuild.core.support.i18n.Language.L("无效实体数据格式 : %s", data.toJSONString()));
}
String entityName = metadata.getString("entity");
if (StringUtils.isBlank(entityName)) {
String id = metadata.getString("id");
if (!ID.isId(id)) {
throw new FieldValueException($L("无效实体数据格式 : %s", data.toJSONString()));
throw new FieldValueException(
com.rebuild.core.support.i18n.Language.L("无效实体数据格式 : %s", data.toJSONString()));
}
entityName = MetadataHelper.getEntityName(ID.valueOf(id));
}

View file

@ -19,6 +19,7 @@ import com.rebuild.core.metadata.easymeta.DisplayType;
import com.rebuild.core.metadata.easymeta.EasyField;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.service.DataSpecificationException;
import com.rebuild.core.support.i18n.Language;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@ -26,8 +27,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 标准 Record 解析
*
@ -109,7 +108,7 @@ public class EntityRecordCreator extends JsonRecordCreator {
if (!notAllowed.isEmpty()) {
throw new DataSpecificationException(
$L("%s 不允许为空", StringUtils.join(notAllowed, " / ")));
Language.L("%s 不允许为空", StringUtils.join(notAllowed, " / ")));
}
}
// 更新
@ -135,7 +134,7 @@ public class EntityRecordCreator extends JsonRecordCreator {
if (!notAllowed.isEmpty()) {
throw new DataSpecificationException(
$L("%s 不允许修改", StringUtils.join(notAllowed, " / ")));
Language.L("%s 不允许修改", StringUtils.join(notAllowed, " / ")));
}
}
}

View file

@ -18,6 +18,7 @@ import com.rebuild.core.Application;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.metadata.impl.DynamicMetadataFactory;
import com.rebuild.core.metadata.impl.GhostEntity;
import com.rebuild.core.support.i18n.Language;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.util.Assert;
@ -25,8 +26,6 @@ import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.List;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 实体元数据
*
@ -102,7 +101,7 @@ public class MetadataHelper {
try {
return getMetadataFactory().getEntity(entityName);
} catch (MissingMetaExcetion ex) {
throw new MissingMetaExcetion($L("实体 [%s] 已经不存在,请检查配置", entityName.toUpperCase()));
throw new MissingMetaExcetion(Language.L("实体 [%s] 已经不存在,请检查配置", entityName.toUpperCase()));
}
}
@ -115,7 +114,7 @@ public class MetadataHelper {
try {
return getMetadataFactory().getEntity(entityCode);
} catch (MissingMetaExcetion ex) {
throw new MissingMetaExcetion($L("实体 [%s] 已经不存在,请检查配置", entityCode));
throw new MissingMetaExcetion(Language.L("实体 [%s] 已经不存在,请检查配置", entityCode));
}
}
@ -138,7 +137,7 @@ public class MetadataHelper {
return getEntity(entityName).getField(fieldName);
} catch (MissingMetaExcetion ex) {
throw new MissingMetaExcetion(
$L("字段 [%s] 已经不存在,请检查配置", (entityName + "#" + fieldName).toUpperCase()));
Language.L("字段 [%s] 已经不存在,请检查配置", (entityName + "#" + fieldName).toUpperCase()));
}
}

View file

@ -11,12 +11,11 @@ import cn.devezhao.persist4j.engine.ID;
import cn.devezhao.persist4j.metadata.BaseMeta;
import com.alibaba.fastjson.JSONObject;
import com.rebuild.core.metadata.impl.EasyFieldConfigProps;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.JSONable;
import org.apache.commons.lang.StringUtils;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 元数据封装
*
@ -122,10 +121,10 @@ public abstract class BaseEasyMeta<T extends BaseMeta> implements BaseMeta, JSON
/**
* @return
* @see com.rebuild.core.support.i18n.Language#$L(BaseMeta)
* @see com.rebuild.core.support.i18n.Language#L(BaseMeta)
*/
public String getLabel() {
return $L(getRawMeta());
return Language.L(getRawMeta());
}
/**
@ -138,7 +137,7 @@ public abstract class BaseEasyMeta<T extends BaseMeta> implements BaseMeta, JSON
if (getMetaId() != null) {
return comments;
}
return StringUtils.defaultIfBlank(comments, $L("系统内置"));
return StringUtils.defaultIfBlank(comments, Language.L("系统内置"));
}
/**

View file

@ -9,11 +9,10 @@ package com.rebuild.core.metadata.easymeta;
import cn.devezhao.persist4j.Field;
import cn.devezhao.persist4j.dialect.editor.BoolEditor;
import com.rebuild.core.support.i18n.Language;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 2020/11/17
@ -51,10 +50,10 @@ public class EasyBool extends EasyField implements MixValue {
@Override
public Object unpackWrapValue(Object wrappedValue) {
if (wrappedValue instanceof Boolean) {
return (Boolean) wrappedValue ? $L("") : $L("");
return (Boolean) wrappedValue ? Language.L("") : Language.L("");
}
return StringUtils.equals(BoolEditor.TRUE + "", wrappedValue.toString())
? $L("") : $L("");
? Language.L("") : Language.L("");
}
}

View file

@ -19,14 +19,13 @@ import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.metadata.easymeta.DisplayType;
import com.rebuild.core.service.trigger.RobotTriggerManager;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.Assert;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 元数据Entity/Field封装
*
@ -161,7 +160,7 @@ public class EasyMeta implements BaseMeta {
if (isField() && ((Field) baseMeta).getType() == FieldType.PRIMARY) {
return "ID";
}
return $L(this.baseMeta);
return Language.L(this.baseMeta);
}
/**
@ -184,7 +183,7 @@ public class EasyMeta implements BaseMeta {
if (getMetaId() != null) {
return comments;
}
return StringUtils.defaultIfBlank(comments, $L("系统内置"));
return StringUtils.defaultIfBlank(comments, Language.L("系统内置"));
}
@Override

View file

@ -25,12 +25,11 @@ import com.rebuild.core.metadata.easymeta.EasyEntity;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.privileges.UserService;
import com.rebuild.core.support.License;
import com.rebuild.core.support.i18n.Language;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.RandomUtils;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 创建实体
*
@ -69,7 +68,7 @@ public class Entity2Schema extends Field2Schema {
public String createEntity(String entityName, String entityLabel, String comments, String mainEntity, boolean haveNameField) {
if (entityName != null) {
if (MetadataHelper.containsEntity(entityName)) {
throw new MetadataModificationException($L("实体已存在 : %s", entityName));
throw new MetadataModificationException(Language.L("实体已存在 : %s", entityName));
}
} else {
@ -85,7 +84,7 @@ public class Entity2Schema extends Field2Schema {
final boolean isDetail = StringUtils.isNotBlank(mainEntity);
if (isDetail && !MetadataHelper.containsEntity(mainEntity)) {
throw new MetadataModificationException($L("无效主实体 : %s", mainEntity));
throw new MetadataModificationException(Language.L("无效主实体 : %s", mainEntity));
}
String physicalName = "T__" + entityName.toUpperCase();
@ -128,38 +127,38 @@ public class Entity2Schema extends Field2Schema {
if (haveNameField) {
createUnsafeField(
tempEntity, nameFiled, $L("%s名称", entityLabel), DisplayType.TEXT, false, true, true, true, true, null, null, null, null, null);
tempEntity, nameFiled, Language.L("%s名称", entityLabel), DisplayType.TEXT, false, true, true, true, true, null, null, null, null, null);
}
createBuiltinField(tempEntity, EntityHelper.CreatedBy, $L("创建人"), DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.CreatedOn, $L("创建时间"), DisplayType.DATETIME, null, null, null);
createBuiltinField(tempEntity, EntityHelper.ModifiedBy, $L("修改人"), DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.ModifiedOn, $L("修改时间"), DisplayType.DATETIME, null, null, null);
createBuiltinField(tempEntity, EntityHelper.CreatedBy, Language.L("创建人"), DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.CreatedOn, Language.L("创建时间"), DisplayType.DATETIME, null, null, null);
createBuiltinField(tempEntity, EntityHelper.ModifiedBy, Language.L("修改人"), DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.ModifiedOn, Language.L("修改时间"), DisplayType.DATETIME, null, null, null);
// 明细实体关联字段
// 明细实体无所属用户或部门使用主实体的
if (isDetail) {
String mainLabel = EasyMetaFactory.valueOf(mainEntity).getLabel();
String mainPrimary = mainEntity + "Id";
createBuiltinField(tempEntity, mainPrimary, mainLabel, DisplayType.REFERENCE, $L("引用主记录"), mainEntity, CascadeModel.Delete);
createBuiltinField(tempEntity, mainPrimary, mainLabel, DisplayType.REFERENCE, Language.L("引用主记录"), mainEntity, CascadeModel.Delete);
} else {
// 助记码/搜索码
createUnsafeField(
tempEntity, EntityHelper.QuickCode, $L("助记码"), DisplayType.TEXT, true, false, false, true, false, null, null, null, null, null);
tempEntity, EntityHelper.QuickCode, Language.L("助记码"), DisplayType.TEXT, true, false, false, true, false, null, null, null, null, null);
createBuiltinField(tempEntity, EntityHelper.OwningUser, $L("所属用户"), DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.OwningDept, $L("所属部门"), DisplayType.REFERENCE, null, "Department", null);
createBuiltinField(tempEntity, EntityHelper.OwningUser, Language.L("所属用户"), DisplayType.REFERENCE, null, "User", null);
createBuiltinField(tempEntity, EntityHelper.OwningDept, Language.L("所属部门"), DisplayType.REFERENCE, null, "Department", null);
}
} catch (Throwable ex) {
log.error(null, ex);
Application.getCommonsService().delete(tempMetaId.toArray(new ID[0]));
throw new MetadataModificationException($L("无法同步元数据到数据库 : %s", ex.getLocalizedMessage()));
throw new MetadataModificationException(Language.L("无法同步元数据到数据库 : %s", ex.getLocalizedMessage()));
}
boolean schemaReady = schema2Database(tempEntity);
if (!schemaReady) {
Application.getCommonsService().delete(tempMetaId.toArray(new ID[0]));
throw new MetadataModificationException($L("无法同步元数据到数据库"));
throw new MetadataModificationException(Language.L("无法同步元数据到数据库"));
}
MetadataHelper.getMetadataFactory().refresh(false);
@ -181,13 +180,13 @@ public class Entity2Schema extends Field2Schema {
*/
public boolean dropEntity(Entity entity, boolean force) {
if (!user.equals(UserService.ADMIN_USER)) {
throw new MetadataModificationException($L("仅超级管理员可删除实体"));
throw new MetadataModificationException(Language.L("仅超级管理员可删除实体"));
}
EasyEntity easy = EasyMetaFactory.valueOf(entity);
ID metaRecordId = easy.getMetaId();
if (easy.isBuiltin() || metaRecordId == null) {
throw new MetadataModificationException($L("系统内置,不允许删除"));
throw new MetadataModificationException(Language.L("系统内置,不允许删除"));
}
// 强制删除先删除明细实体
@ -199,11 +198,11 @@ public class Entity2Schema extends Field2Schema {
if (dropDetail) {
entity = MetadataHelper.getEntity(entity.getEntityCode());
} else {
throw new MetadataModificationException($L("不能直接删除主实体,请先删除明细实体"));
throw new MetadataModificationException(Language.L("不能直接删除主实体,请先删除明细实体"));
}
} else {
throw new MetadataModificationException($L("不能直接删除主实体,请先删除明细实体"));
throw new MetadataModificationException(Language.L("不能直接删除主实体,请先删除明细实体"));
}
}
@ -211,14 +210,14 @@ public class Entity2Schema extends Field2Schema {
if (whoRef.getOwnEntity().equals(entity)) continue;
if (whoRef.getType() == FieldType.ANY_REFERENCE) continue;
throw new MetadataModificationException(
$L("实体已被其他实体引用 (引用实体 : %s)", $L(whoRef.getOwnEntity())));
Language.L("实体已被其他实体引用 (引用实体 : %s)", Language.L(whoRef.getOwnEntity())));
}
// 有记录的强删
if (!force) {
long count;
if ((count = checkRecordCount(entity)) > 0) {
throw new MetadataModificationException($L("不能删除有数据的实体 (记录数 : %d)", count));
throw new MetadataModificationException(Language.L("不能删除有数据的实体 (记录数 : %d)", count));
}
}

View file

@ -27,6 +27,7 @@ import com.rebuild.core.metadata.easymeta.DisplayType;
import com.rebuild.core.metadata.easymeta.EasyField;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.setup.Installer;
import com.rebuild.utils.BlockList;
import com.rebuild.utils.RbAssert;
@ -38,8 +39,6 @@ import org.apache.commons.lang.math.RandomUtils;
import java.util.HashSet;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 创建字段
*
@ -59,7 +58,7 @@ public class Field2Schema {
* @param user
*/
public Field2Schema(ID user) {
RbAssert.isAllow(UserHelper.isSuperAdmin(user), $L("仅超级管理员可操作"));
RbAssert.isAllow(UserHelper.isSuperAdmin(user), Language.L("仅超级管理员可操作"));
this.user = user;
}
@ -75,7 +74,7 @@ public class Field2Schema {
public String createField(Entity entity, String fieldLabel, DisplayType type, String comments, String refEntity, JSON extConfig) {
long count;
if ((count = checkRecordCount(entity)) > 100000) {
throw new MetadataModificationException($L("实体记录过多 (%d),增加/删除字段可能导致表损坏", count));
throw new MetadataModificationException(Language.L("实体记录过多 (%d),增加/删除字段可能导致表损坏", count));
}
String fieldName = toPinyinName(fieldLabel);
@ -93,7 +92,7 @@ public class Field2Schema {
boolean schemaReady = schema2Database(entity, new Field[]{field});
if (!schemaReady) {
Application.getCommonsService().delete(tempMetaId.toArray(new ID[0]));
throw new MetadataModificationException($L("无法同步元数据到数据库"));
throw new MetadataModificationException(Language.L("无法同步元数据到数据库"));
}
MetadataHelper.getMetadataFactory().refresh(false);
@ -109,18 +108,18 @@ public class Field2Schema {
EasyField easyMeta = EasyMetaFactory.valueOf(field);
ID metaRecordId = easyMeta.getMetaId();
if (easyMeta.isBuiltin() || metaRecordId == null) {
throw new MetadataModificationException($L("系统内置,不允许删除"));
throw new MetadataModificationException(Language.L("系统内置,不允许删除"));
}
Entity entity = field.getOwnEntity();
if (entity.getNameField().equals(field)) {
throw new MetadataModificationException($L("名称字段不允许删除"));
throw new MetadataModificationException(Language.L("名称字段不允许删除"));
}
if (!force) {
long count;
if ((count = checkRecordCount(entity)) > 100000) {
throw new MetadataModificationException($L("实体记录过多 (%d),增加/删除字段可能导致表损坏", count));
throw new MetadataModificationException(Language.L("实体记录过多 (%d),增加/删除字段可能导致表损坏", count));
}
}
@ -269,7 +268,7 @@ public class Field2Schema {
// 在导入实体时需要需自行保证引用实体有效性否则系统会出错
if (!DynamicMetadataContextHolder.isSkipRefentityCheck(false)) {
if (!MetadataHelper.containsEntity(refEntity)) {
throw new MetadataModificationException($L("无效引用实体 : %s", refEntity));
throw new MetadataModificationException(Language.L("无效引用实体 : %s", refEntity));
}
}
@ -289,7 +288,7 @@ public class Field2Schema {
recordOfField.setInt("maxLength", maxLength);
if ((dt == DisplayType.REFERENCE || dt == DisplayType.N2NREFERENCE) && StringUtils.isBlank(refEntity)) {
throw new MetadataModificationException($L("引用字段必须指定引用实体"));
throw new MetadataModificationException(Language.L("引用字段必须指定引用实体"));
}
recordOfField = Application.getCommonsService().create(recordOfField);

View file

@ -22,8 +22,6 @@ import com.rebuild.core.service.DataSpecificationException;
import com.rebuild.core.support.i18n.Language;
import org.springframework.stereotype.Service;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* for Department
*
@ -64,14 +62,14 @@ public class DepartmentService extends BaseServiceImpl {
if (record.hasValue("parentDept", false)) {
ID parentDept = record.getID("parentDept");
if (parentDept.equals(record.getPrimary())) {
throw new DataSpecificationException($L("父级部门不能选择自己"));
throw new DataSpecificationException(Language.L("父级部门不能选择自己"));
}
Department parent = Application.getUserStore().getDepartment(parentDept);
Department that = Application.getUserStore().getDepartment(record.getPrimary());
if (that.isChildren(parent, true)) {
throw new DataSpecificationException($L("子级部门不能同时作为父级部门"));
throw new DataSpecificationException(Language.L("子级部门不能同时作为父级部门"));
}
}
@ -97,10 +95,10 @@ public class DepartmentService extends BaseServiceImpl {
Department dept = Application.getUserStore().getDepartment(deptId);
if (!dept.getMembers().isEmpty()) {
throw new OperationDeniedException(Language.$L("部门下有用户禁止删除"));
throw new OperationDeniedException(Language.L("部门下有用户禁止删除"));
}
if (!dept.getChildren().isEmpty()) {
throw new OperationDeniedException(Language.$L("部门下有子部门禁止删除"));
throw new OperationDeniedException(Language.L("部门下有子部门禁止删除"));
}
super.delete(deptId);
@ -117,7 +115,7 @@ public class DepartmentService extends BaseServiceImpl {
if (UserHelper.isAdmin(currentUser)) return;
if (action == BizzPermission.CREATE || action == BizzPermission.DELETE) {
throw new PrivilegesException($L("无操作权限"));
throw new PrivilegesException(Language.L("无操作权限"));
}
// 用户可自己改自己的部门
@ -125,6 +123,6 @@ public class DepartmentService extends BaseServiceImpl {
if (action == BizzPermission.UPDATE && dept.equals(currentDeptOfUser)) {
return;
}
throw new PrivilegesException($L("无操作权限"));
throw new PrivilegesException(Language.L("无操作权限"));
}
}

View file

@ -20,7 +20,7 @@ public class OperationDeniedException extends RebuildException {
private static final long serialVersionUID = 2670636377089379190L;
public OperationDeniedException() {
super(Language.$L("无权操作"));
super(Language.L("无权操作"));
}
public OperationDeniedException(String msg) {

View file

@ -22,6 +22,7 @@ import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.service.CommonsService;
import com.rebuild.core.service.general.BulkContext;
import com.rebuild.core.service.general.EntityService;
import com.rebuild.core.support.i18n.Language;
import lombok.extern.slf4j.Slf4j;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
@ -31,8 +32,6 @@ import java.lang.reflect.Method;
import java.security.Guard;
import java.util.Objects;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 权限验证 - 拦截所有 *Service 方法
*
@ -63,7 +62,7 @@ public class PrivilegesGuardInterceptor implements MethodInterceptor, Guard {
Class<?> invocationClass = Objects.requireNonNull(invocation.getThis()).getClass();
// 验证管理员操作
if (AdminGuard.class.isAssignableFrom(invocationClass) && !UserHelper.isAdmin(caller)) {
throw new AccessDeniedException($L("权限不足,访问被阻止"));
throw new AccessDeniedException(Language.L("权限不足,访问被阻止"));
}
// EntityService 或子类会验证角色权限
if (!EntityService.class.isAssignableFrom(invocationClass)) {
@ -116,7 +115,7 @@ public class PrivilegesGuardInterceptor implements MethodInterceptor, Guard {
Field dtmField = MetadataHelper.getDetailToMainField(entity);
ID mainid = ((Record) idOrRecord).getID(dtmField.getName());
if (mainid == null || !Application.getPrivilegesManager().allowUpdate(caller, mainid)) {
throw new AccessDeniedException($L("你没有添加明细权限"));
throw new AccessDeniedException(Language.L("你没有添加明细权限"));
}
allowed = true;
@ -196,23 +195,23 @@ public class PrivilegesGuardInterceptor implements MethodInterceptor, Guard {
private String formatHumanMessage(Permission action, Entity entity, ID target) {
String actionHuman = null;
if (action == BizzPermission.CREATE) {
actionHuman = $L("新建");
actionHuman = Language.L("新建");
} else if (action == BizzPermission.DELETE) {
actionHuman = $L("删除");
actionHuman = Language.L("删除");
} else if (action == BizzPermission.UPDATE) {
actionHuman = $L("编辑");
actionHuman = Language.L("编辑");
} else if (action == BizzPermission.ASSIGN) {
actionHuman = $L("分派");
actionHuman = Language.L("分派");
} else if (action == BizzPermission.SHARE) {
actionHuman = $L("共享");
actionHuman = Language.L("共享");
} else if (action == EntityService.UNSHARE) {
actionHuman = $L("取消共享");
actionHuman = Language.L("取消共享");
}
if (target == null) {
return $L("你没有%s%s权限", actionHuman, EasyMetaFactory.getLabel(entity));
return Language.L("你没有%s%s权限", actionHuman, EasyMetaFactory.getLabel(entity));
} else {
return $L("你没有%s此记录的权限", actionHuman);
return Language.L("你没有%s此记录的权限", actionHuman);
}
}
}

View file

@ -38,8 +38,6 @@ import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* for User
*
@ -105,7 +103,7 @@ public class UserService extends BaseServiceImpl {
checkAdminGuard(BizzPermission.DELETE, null);
if (ADMIN_USER.equals(record) || SYSTEM_USER.equals(record)) {
throw new OperationDeniedException($L("内置用户禁止删除"));
throw new OperationDeniedException(Language.L("内置用户禁止删除"));
}
Object[] hasLogin = Application.createQueryNoFilter(
@ -113,7 +111,7 @@ public class UserService extends BaseServiceImpl {
.setParameter(1, record)
.unique();
if (ObjectUtils.toInt(hasLogin[0]) > 0) {
throw new OperationDeniedException($L("已使用过的用户禁止删除"));
throw new OperationDeniedException(Language.L("已使用过的用户禁止删除"));
}
super.delete(record);
@ -136,7 +134,7 @@ public class UserService extends BaseServiceImpl {
}
if (record.hasValue("email") && Application.getUserStore().existsUser(record.getString("email"))) {
throw new DataSpecificationException($L("邮箱已存在"));
throw new DataSpecificationException(Language.L("邮箱已存在"));
}
if (record.getPrimary() == null && !record.hasValue("fullName")) {
@ -158,11 +156,11 @@ public class UserService extends BaseServiceImpl {
*/
private void checkLoginName(String loginName) throws DataSpecificationException {
if (Application.getUserStore().existsUser(loginName)) {
throw new DataSpecificationException($L("用户名已存在"));
throw new DataSpecificationException(Language.L("用户名已存在"));
}
if (!CommonsUtils.isPlainText(loginName) || BlockList.isBlock(loginName)) {
throw new DataSpecificationException($L("用户名无效"));
throw new DataSpecificationException(Language.L("用户名无效"));
}
}
@ -176,13 +174,13 @@ public class UserService extends BaseServiceImpl {
if (UserHelper.isAdmin(currentUser)) return;
if (action == BizzPermission.CREATE || action == BizzPermission.DELETE) {
throw new AccessDeniedException($L("无操作权限"));
throw new AccessDeniedException(Language.L("无操作权限"));
}
// 用户可自己改自己
if (action == BizzPermission.UPDATE && currentUser.equals(user)) return;
throw new AccessDeniedException($L("无操作权限"));
throw new AccessDeniedException(Language.L("无操作权限"));
}
/**
@ -193,7 +191,7 @@ public class UserService extends BaseServiceImpl {
*/
protected void checkPassword(String password) throws DataSpecificationException {
if (password.length() < 6) {
throw new DataSpecificationException($L("密码不能小于 6 位"));
throw new DataSpecificationException(Language.L("密码不能小于 6 位"));
}
int policy = RebuildConfiguration.getInt(ConfigurationItem.PasswordPolicy);
@ -218,10 +216,10 @@ public class UserService extends BaseServiceImpl {
}
if (countUpper == 0 || countLower == 0 || countDigit == 0) {
throw new DataSpecificationException($L("密码不能小于 6 位,且必须包含数字和大小写字母"));
throw new DataSpecificationException(Language.L("密码不能小于 6 位,且必须包含数字和大小写字母"));
}
if (policy >= 3 && (countSpecial == 0 || password.length() < 8)) {
throw new DataSpecificationException($L("密码不能小于 8 位,且必须包含数字和大小写字母及特殊字符"));
throw new DataSpecificationException(Language.L("密码不能小于 8 位,且必须包含数字和大小写字母及特殊字符"));
}
}
@ -239,10 +237,10 @@ public class UserService extends BaseServiceImpl {
String homeUrl = RebuildConfiguration.getHomeUrl();
LanguageBundle bundle = Language.getSysDefaultBundle();
String content = bundle.$L("系统管理员已经为你开通了 %s 账号!以下为你的登录信息,请妥善保管。 [] 登录账号 : **%s** [] 登录密码 : **%s** [] 登录地址 : [%s](%s) [][] 首次登陆,建议你立即修改登陆密码。修改方式 : 登陆后点击右上角头像 - 个人设置 - 安全设置 - 更改密码",
String content = bundle.L("系统管理员已经为你开通了 %s 账号!以下为你的登录信息,请妥善保管。 [] 登录账号 : **%s** [] 登录密码 : **%s** [] 登录地址 : [%s](%s) [][] 首次登陆,建议你立即修改登陆密码。修改方式 : 登陆后点击右上角头像 - 个人设置 - 安全设置 - 更改密码",
appName, newUser.getString("loginName"), passwd, homeUrl, homeUrl);
SMSender.sendMailAsync(newUser.getString("email"), $L("你的账号已就绪"), content);
SMSender.sendMailAsync(newUser.getString("email"), Language.L("你的账号已就绪"), content);
return true;
}
@ -363,7 +361,7 @@ public class UserService extends BaseServiceImpl {
// 通知管理员
ID newUserId = record.getPrimary();
String viewUrl = AppUtils.getContextPath() + "/app/list-and-view?id=" + newUserId;
String content = $L("用户 @%s 提交了注册申请。请验证用户有效性后为其指定部门和角色,激活用户登录。如果这是一个无效的申请请忽略。[点击开始激活](%s)",
String content = Language.L("用户 @%s 提交了注册申请。请验证用户有效性后为其指定部门和角色,激活用户登录。如果这是一个无效的申请请忽略。[点击开始激活](%s)",
newUserId, viewUrl);
Message message = MessageBuilder.createMessage(ADMIN_USER, content, newUserId);

View file

@ -28,6 +28,7 @@ import com.rebuild.core.metadata.impl.MetadataModificationException;
import com.rebuild.core.privileges.UserService;
import com.rebuild.core.service.approval.RobotApprovalConfigService;
import com.rebuild.core.service.trigger.RobotTriggerConfigService;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.task.HeavyTask;
import com.rebuild.utils.JSONUtils;
@ -35,8 +36,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 元数据模型导入
*
@ -84,7 +83,7 @@ public class MetaschemaImporter extends HeavyTask<String> {
private String verfiyEntity(JSONObject entity) {
String entityName = entity.getString("entity");
if (MetadataHelper.containsEntity(entityName)) {
return $L("实体名称已存在 : %s",entityName);
return Language.L("实体名称已存在 : %s",entityName);
}
for (Object o : entity.getJSONArray("fields")) {
@ -93,7 +92,7 @@ public class MetaschemaImporter extends HeavyTask<String> {
if (DisplayType.REFERENCE.name().equals(dt) || DisplayType.N2NREFERENCE.name().equals(dt)) {
String refEntity = field.getString("refEntity");
if (!entityName.equals(refEntity) && !MetadataHelper.containsEntity(refEntity)) {
return $L("缺少必要的引用实体 : %s (%s)", field.getString("fieldLabel"), refEntity);
return Language.L("缺少必要的引用实体 : %s (%s)", field.getString("fieldLabel"), refEntity);
}
}
}

View file

@ -19,8 +19,7 @@ import com.rebuild.core.metadata.easymeta.DisplayType;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.metadata.impl.Field2Schema;
import com.rebuild.core.metadata.impl.MetadataModificationException;
import static com.rebuild.core.support.i18n.Language.$L;
import com.rebuild.core.support.i18n.Language;
/**
* 审批流程字段
@ -47,11 +46,11 @@ public class ApprovalFields2Schema extends Field2Schema {
throw new RebuildException("Unsupported entity : " + approvalEntity.getName());
}
Field apporvalId = createUnsafeField(approvalEntity, EntityHelper.ApprovalId, $L("审核流程"),
Field apporvalId = createUnsafeField(approvalEntity, EntityHelper.ApprovalId, Language.L("审核流程"),
DisplayType.REFERENCE, true, false, false, true, true, null, "RobotApprovalConfig", CascadeModel.Ignore, null, null);
Field apporvalState = createUnsafeField(approvalEntity, EntityHelper.ApprovalState, $L("审核状态"),
Field apporvalState = createUnsafeField(approvalEntity, EntityHelper.ApprovalState, Language.L("审核状态"),
DisplayType.STATE, true, false, false, true, true, null, null, null, null, ApprovalState.DRAFT.getState());
Field apporvalStepId = createUnsafeField(approvalEntity, EntityHelper.ApprovalStepNode, $L("审核步骤"),
Field apporvalStepId = createUnsafeField(approvalEntity, EntityHelper.ApprovalStepNode, Language.L("审核步骤"),
DisplayType.TEXT, true, false, false, true, false, null, null, null, null, null);
boolean schemaReady = schema2Database(approvalEntity,
@ -59,7 +58,7 @@ public class ApprovalFields2Schema extends Field2Schema {
if (!schemaReady) {
Application.getCommonsService().delete(tempMetaId.toArray(new ID[0]));
throw new MetadataModificationException($L("无法同步元数据到数据库"));
throw new MetadataModificationException(Language.L("无法同步元数据到数据库"));
}
MetadataHelper.getMetadataFactory().refresh(false);

View file

@ -15,11 +15,10 @@ import com.rebuild.core.Application;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.service.NoRecordFoundException;
import com.rebuild.core.support.i18n.Language;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 2019/10/23
@ -64,7 +63,7 @@ public class ApprovalHelper {
Object[] o = Application.getQueryFactory().uniqueNoFilter(recordId,
EntityHelper.ApprovalId, EntityHelper.ApprovalId + ".name", EntityHelper.ApprovalState, EntityHelper.ApprovalStepNode);
if (o == null) {
throw new NoRecordFoundException($L("无权读取此记录或记录已被删除"));
throw new NoRecordFoundException(Language.L("无权读取此记录或记录已被删除"));
}
return new ApprovalStatus((ID) o[0], (String) o[1], (Integer) o[2], (String) o[3], recordId);
}

View file

@ -20,6 +20,7 @@ import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.service.general.EntityService;
import com.rebuild.core.support.SetUser;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
@ -28,8 +29,6 @@ import org.springframework.util.Assert;
import java.util.*;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 审批处理
*
@ -76,7 +75,7 @@ public class ApprovalProcessor extends SetUser {
public boolean submit(JSONObject selectNextUsers) throws ApprovalException {
final ApprovalState currentState = ApprovalHelper.getApprovalState(this.record);
if (currentState == ApprovalState.PROCESSING || currentState == ApprovalState.APPROVED) {
throw new ApprovalException($L("无效审批状态 (%s) ,请刷新后重试", currentState));
throw new ApprovalException(Language.L("无效审批状态 (%s) ,请刷新后重试", currentState));
}
FlowNodeGroup nextNodes = getNextNodes(FlowNode.NODE_ROOT);
@ -134,7 +133,7 @@ public class ApprovalProcessor extends SetUser {
final ApprovalStatus status = ApprovalHelper.getApprovalStatus(this.record);
ApprovalState currentState = status.getCurrentState();
if (currentState != ApprovalState.PROCESSING) {
throw new ApprovalException($L("无效审批状态 (%s) ,请刷新后重试", currentState));
throw new ApprovalException(Language.L("无效审批状态 (%s) ,请刷新后重试", currentState));
}
final Object[] stepApprover = Application.createQueryNoFilter(
@ -144,8 +143,8 @@ public class ApprovalProcessor extends SetUser {
.setParameter(3, getCurrentNodeId(status))
.unique();
if (stepApprover == null || (Integer) stepApprover[1] != ApprovalState.DRAFT.getState()) {
throw new ApprovalException($L(stepApprover == null
? $L("当前流程已经被他人审批") : $L("你已经审批过当前流程")));
throw new ApprovalException(Language.L(stepApprover == null
? Language.L("当前流程已经被他人审批") : Language.L("你已经审批过当前流程")));
}
Record approvedStep = EntityHelper.forUpdate((ID) stepApprover[0], approver);
@ -164,7 +163,7 @@ public class ApprovalProcessor extends SetUser {
if (state == ApprovalState.APPROVED && !nextNodes.isLastStep()) {
nextApprovers = nextNodes.getApproveUsers(this.getUser(), this.record, selectNextUsers);
if (nextApprovers.isEmpty()) {
throw new ApprovalException($L("下一流程无审批人可用,请联系管理员配置"));
throw new ApprovalException(Language.L("下一流程无审批人可用,请联系管理员配置"));
}
FlowNode nextApprovalNode = nextNodes.getApprovalNode();
@ -191,7 +190,7 @@ public class ApprovalProcessor extends SetUser {
final ApprovalStatus status = ApprovalHelper.getApprovalStatus(this.record);
ApprovalState currentState = status.getCurrentState();
if (currentState != ApprovalState.PROCESSING) {
throw new ApprovalException($L("无效审批状态 (%s) ,请刷新后重试", currentState));
throw new ApprovalException(Language.L("无效审批状态 (%s) ,请刷新后重试", currentState));
}
Application.getBean(ApprovalStepService.class).txCancel(
@ -206,7 +205,7 @@ public class ApprovalProcessor extends SetUser {
public void revoke() throws ApprovalException {
final ApprovalStatus status = ApprovalHelper.getApprovalStatus(this.record);
if (status.getCurrentState() != ApprovalState.APPROVED) {
throw new ApprovalException($L("无效审批状态 (%s) ,请刷新后重试", status.getCurrentState()));
throw new ApprovalException(Language.L("无效审批状态 (%s) ,请刷新后重试", status.getCurrentState()));
}
Object[] count = Application.createQueryNoFilter(
@ -215,7 +214,7 @@ public class ApprovalProcessor extends SetUser {
.setParameter(2, ApprovalState.REVOKED.getState())
.unique();
if (ObjectUtils.toInt(count[0]) >= MAX_REVOKED) {
throw new ApprovalException($L("记录撤销次数已达 %d 次,不能再次撤销", MAX_REVOKED));
throw new ApprovalException(Language.L("记录撤销次数已达 %d 次,不能再次撤销", MAX_REVOKED));
}
Application.getBean(ApprovalStepService.class).txCancel(
@ -388,7 +387,7 @@ public class ApprovalProcessor extends SetUser {
stepGroup.add(o);
}
if (firstStep == null) {
throw new ConfigurationException($L("无效审批记录 (%s)", this.record));
throw new ConfigurationException(Language.L("无效审批记录 (%s)", this.record));
}
JSONArray steps = new JSONArray();

View file

@ -20,12 +20,11 @@ import com.rebuild.core.service.BaseService;
import com.rebuild.core.service.DataSpecificationNoRollbackException;
import com.rebuild.core.service.general.GeneralEntityServiceContextHolder;
import com.rebuild.core.service.notification.MessageBuilder;
import com.rebuild.core.support.i18n.Language;
import org.springframework.stereotype.Service;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 审批流程此类所有方法不应直接调用而是通过 ApprovalProcessor
* <p>
@ -70,7 +69,7 @@ public class ApprovalStepService extends BaseService {
String entityLabel = EasyMetaFactory.getLabel(recordOfMain.getEntity());
// 审批人
String approvalMsg = $L("有一条 %s 记录请你审批", entityLabel);
String approvalMsg = Language.L("有一条 %s 记录请你审批", entityLabel);
Record step = EntityHelper.forNew(EntityHelper.RobotApprovalStep, submitter);
step.setID("recordId", recordId);
@ -87,7 +86,7 @@ public class ApprovalStepService extends BaseService {
// 抄送人
if (cc != null && !cc.isEmpty()) {
String ccMsg = $L("用户 @%s 提交了一条 %s 审批,请知晓", submitter, entityLabel);
String ccMsg = Language.L("用户 @%s 提交了一条 %s 审批,请知晓", submitter, entityLabel);
for (ID to : cc) {
Application.getNotifications().send(MessageBuilder.createApproval(to, ccMsg, recordId));
}
@ -128,7 +127,7 @@ public class ApprovalStepService extends BaseService {
ApprovalProcessor approvalProcessor = new ApprovalProcessor((ID) stepObject[0], (ID) stepObject[1]);
FlowNodeGroup nextNodes = approvalProcessor.getNextNodes();
if (!nextNodes.getGroupId().equals(checkUseGroup)) {
throw new DataSpecificationNoRollbackException($L("由于更改数据导致流程变化,你需要重新审批"));
throw new DataSpecificationNoRollbackException(Language.L("由于更改数据导致流程变化,你需要重新审批"));
}
}
}
@ -151,8 +150,8 @@ public class ApprovalStepService extends BaseService {
// 抄送人
if (cc != null && !cc.isEmpty()) {
String ccMsg = $L("用户 @%s 提交的 %s 审批已由 @%s %s请知晓",
submitter, entityLabel, approver, $L(state));
String ccMsg = Language.L("用户 @%s 提交的 %s 审批已由 @%s %s请知晓",
submitter, entityLabel, approver, Language.L(state));
for (ID c : cc) {
Application.getNotifications().send(MessageBuilder.createApproval(c, ccMsg, recordId));
}
@ -168,7 +167,7 @@ public class ApprovalStepService extends BaseService {
recordOfMain.setInt(EntityHelper.ApprovalState, ApprovalState.REJECTED.getState());
super.update(recordOfMain);
String rejectedMsg = $L("@%s 驳回了你的 %s 审批", approver, entityLabel);
String rejectedMsg = Language.L("@%s 驳回了你的 %s 审批", approver, entityLabel);
Application.getNotifications().send(MessageBuilder.createApproval(submitter, rejectedMsg, recordId));
return;
}
@ -176,7 +175,7 @@ public class ApprovalStepService extends BaseService {
// 或签/会签
boolean goNextNode = true;
String approvalMsg = $L("有一条 %s 记录请你审批", entityLabel);
String approvalMsg = Language.L("有一条 %s 记录请你审批", entityLabel);
// 或签一人通过其他作废
if (FlowNode.SIGN_OR.equals(signMode)) {
@ -391,7 +390,7 @@ public class ApprovalStepService extends BaseService {
FlowNode.NODE_AUTOAPPROVAL, useApprover, false, FlowNode.NODE_ROOT);
Record step = EntityHelper.forUpdate(stepId, useApprover, false);
step.setInt("state", ApprovalState.APPROVED.getState());
step.setString("remark", $L("自动审批"));
step.setString("remark", Language.L("自动审批"));
super.update(step);
// 更新记录审批状态

View file

@ -10,13 +10,12 @@ package com.rebuild.core.service.approval;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import org.apache.commons.lang.StringUtils;
import java.util.*;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 流程解析
*
@ -125,7 +124,7 @@ public class FlowParser {
if (nodeMap.containsKey(nodeId)) {
return nodeMap.get(nodeId);
}
throw new ApprovalException($L("无效审核步骤节点 (%s)", nodeId));
throw new ApprovalException(Language.L("无效审核步骤节点 (%s)", nodeId));
}
/**

View file

@ -23,8 +23,6 @@ import com.rebuild.core.service.DataSpecificationException;
import com.rebuild.core.support.i18n.Language;
import org.springframework.stereotype.Service;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 审批流程
*
@ -56,7 +54,7 @@ public class RobotApprovalConfigService extends BaseConfigurationService impleme
if (record.hasValue("flowDefinition")) {
int inUsed = ApprovalHelper.checkInUsed(record.getPrimary());
if (inUsed > 0) {
throw new DataSpecificationException($L("有 %d 条记录正在使用此流程,禁止修改", inUsed));
throw new DataSpecificationException(Language.L("有 %d 条记录正在使用此流程,禁止修改", inUsed));
}
}
return super.update(record);
@ -75,7 +73,7 @@ public class RobotApprovalConfigService extends BaseConfigurationService impleme
}
if (inUsed > 0) {
throw new DataSpecificationException($L("有 %d 条记录正在使用此流程,禁止删除", inUsed));
throw new DataSpecificationException(Language.L("有 %d 条记录正在使用此流程,禁止删除", inUsed));
}
return super.delete(recordId);
}

View file

@ -21,8 +21,6 @@ import com.rebuild.utils.JSONUtils;
import java.util.Arrays;
import java.util.Comparator;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 首页仪表盘
*
@ -58,7 +56,7 @@ public class DashboardManager extends ShareToManager {
if (detected == null) {
Record record = EntityHelper.forNew(EntityHelper.DashboardConfig, user);
record.setString("config", JSONUtils.EMPTY_ARRAY_STR);
record.setString("title", UserHelper.isAdmin(user) ? $L("默认仪表盘") : $L("我的仪表盘"));
record.setString("title", UserHelper.isAdmin(user) ? Language.L("默认仪表盘") : Language.L("我的仪表盘"));
record.setString("shareTo", UserHelper.isAdmin(user) ? SHARE_ALL : SHARE_SELF);
Application.getBean(DashboardConfigService.class).create(record);
}

View file

@ -34,8 +34,6 @@ import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.util.*;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 图表数据
*
@ -157,7 +155,7 @@ public abstract class ChartData extends SetUser implements ChartSpec {
private Field[] getValidFields(JSONObject item) {
String fieldName = item.getString("field");
if (MetadataHelper.getLastJoinField(getSourceEntity(), fieldName) == null) {
throw new DefinedException($L("字段 [%s] 已不存在,请调整图表配置", fieldName.toUpperCase()));
throw new DefinedException(Language.L("字段 [%s] 已不存在,请调整图表配置", fieldName.toUpperCase()));
}
Field[] fields = new Field[2];

View file

@ -22,8 +22,6 @@ import com.rebuild.core.service.dashboard.charts.builtin.BuiltinChart;
import com.rebuild.core.service.dashboard.charts.builtin.FeedsSchedule;
import com.rebuild.core.support.i18n.Language;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 12/15/2018
@ -38,7 +36,7 @@ public class ChartsFactory {
public static ChartData create(ID chartId) throws ChartsException {
ConfigBean chart = ChartManager.instance.getChart(chartId);
if (chart == null) {
throw new ChartsException($L("无效图表"));
throw new ChartsException(Language.L("无效图表"));
}
JSONObject config = (JSONObject) chart.getJSON("config");
@ -55,12 +53,12 @@ public class ChartsFactory {
public static ChartData create(JSONObject config, ID user) throws ChartsException {
String entityName = config.getString("entity");
if (!MetadataHelper.containsEntity(entityName)) {
throw new ChartsException($L("源实体 [%s] 已不存在", entityName.toUpperCase()));
throw new ChartsException(Language.L("源实体 [%s] 已不存在", entityName.toUpperCase()));
}
Entity entity = MetadataHelper.getEntity(entityName);
if (user == null || !Application.getPrivilegesManager().allowRead(user, entity.getEntityCode())) {
throw new DefinedException($L("没有读取 %s 的权限", EasyMetaFactory.getLabel(entity)));
throw new DefinedException(Language.L("没有读取 %s 的权限", EasyMetaFactory.getLabel(entity)));
}
String type = config.getString("type");

View file

@ -48,7 +48,7 @@ public class ApprovalList extends ChartData implements BuiltinChart {
@Override
public String getChartTitle() {
return Language.$L("我的审批");
return Language.L("我的审批");
}
@Override

View file

@ -44,7 +44,7 @@ public class FeedsSchedule extends ChartData implements BuiltinChart {
@Override
public String getChartTitle() {
return Language.$L("我的日程");
return Language.L("我的日程");
}
@Override

View file

@ -23,17 +23,11 @@ import com.rebuild.core.support.general.DataListWrapper;
import com.rebuild.core.support.i18n.Language;
import org.apache.commons.lang.StringUtils;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 数据导出
*
@ -162,13 +156,13 @@ public class DataExporter extends SetUser {
}
if (cellVal.toString().equals(DataListWrapper.NO_READ_PRIVILEGES)) {
cellVal = $L("[无权限]");
cellVal = Language.L("[无权限]");
} else if (dt == DisplayType.FILE
|| dt == DisplayType.IMAGE
|| dt == DisplayType.AVATAR
|| dt == DisplayType.BARCODE) {
cellVal = $L("[暂不支持]");
cellVal = Language.L("[暂不支持]");
} else if (dt == DisplayType.DECIMAL || dt == DisplayType.NUMBER) {
cellVal = cellVal.toString().replace(",", ""); // 移除千分位

View file

@ -29,8 +29,6 @@ import org.springframework.util.Assert;
import java.io.File;
import java.util.*;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 报表生成 easyexcel
* https://alibaba-easyexcel.github.io/quickstart/fill.html
@ -180,8 +178,8 @@ public class EasyExcelGenerator extends SetUser {
protected Map<String, Object> buildData(Record record, Map<String, String> varsMap, boolean isDetail) {
final Entity entity = record.getEntity();
final String badFieldTip = $L("[无效字段]");
final String unsupportFieldTip = $L("[暂不支持]");
final String badFieldTip = Language.L("[无效字段]");
final String unsupportFieldTip = Language.L("[暂不支持]");
final Map<String, Object> data = new HashMap<>();
// 无效字段填充

View file

@ -86,7 +86,7 @@ public class FeedsScheduleJob extends DistributedJobLock {
// 消息通知
if (!notifications.isEmpty()) {
String subject = bundle.$L("你有 %d 条日程提醒", notifications.size());
String subject = bundle.L("你有 %d 条日程提醒", notifications.size());
String contents = subject + mergeContents(notifications, false);
Application.getNotifications().send(
MessageBuilder.createMessage(toUser, contents, Message.TYPE_FEEDS));
@ -95,7 +95,7 @@ public class FeedsScheduleJob extends DistributedJobLock {
// 邮件
final String emailAddr = Application.getUserStore().getUser(toUser).getEmail();
if (SMSender.availableMail() && RegexUtils.isEMail(emailAddr) && !emails.isEmpty()) {
String subject = bundle.$L("你有 %d 条日程提醒", emails.size());
String subject = bundle.L("你有 %d 条日程提醒", emails.size());
String contents = mergeContents(emails, true);
contents = MessageBuilder.formatMessage(contents, true, false);
SMSender.sendMailAsync(emailAddr, subject, contents);
@ -104,7 +104,7 @@ public class FeedsScheduleJob extends DistributedJobLock {
// 短信考虑短信字数内容简化了
final String mobileAddr = Application.getUserStore().getUser(toUser).getWorkphone();
if (SMSender.availableSMS() && RegexUtils.isCNMobile(mobileAddr) && !smss.isEmpty()) {
String subject = bundle.$L("你有 %d 条日程提醒", smss.size());
String subject = bundle.L("你有 %d 条日程提醒", smss.size());
SMSender.sendSMSAsync(mobileAddr, subject);
}
}

View file

@ -39,7 +39,7 @@ public class FeedsService extends BaseFeedsService {
Integer type = record.getInt("type");
if (type != null && type == FeedsType.ANNOUNCEMENT.getMask()
&& !UserHelper.isAdmin(UserContextHolder.getUser())) {
throw new OperationDeniedException(Language.$L("仅管理员可发布公告"));
throw new OperationDeniedException(Language.L("仅管理员可发布公告"));
}
return super.createOrUpdate(record);

View file

@ -18,8 +18,6 @@ import com.rebuild.core.service.DataSpecificationException;
import com.rebuild.core.support.i18n.Language;
import org.springframework.stereotype.Service;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 文件目录
*
@ -45,7 +43,7 @@ public class AttachmentFolderService extends BaseService {
.setParameter(1, recordId)
.unique();
if (inFolder != null) {
throw new DataSpecificationException($L("目录内有文件不能删除"));
throw new DataSpecificationException(Language.L("目录内有文件不能删除"));
}
Object parent = Application.createQueryNoFilter(
@ -53,7 +51,7 @@ public class AttachmentFolderService extends BaseService {
.setParameter(1, recordId)
.unique();
if (parent != null) {
throw new DataSpecificationException($L("目录下有子目录不能删除"));
throw new DataSpecificationException(Language.L("目录下有子目录不能删除"));
}
ID user = UserContextHolder.getUser();
@ -63,7 +61,7 @@ public class AttachmentFolderService extends BaseService {
.setParameter(1, recordId)
.unique();
if (!user.equals(createdBy[0])) {
throw new DataSpecificationException($L("无权删除他人目录"));
throw new DataSpecificationException(Language.L("无权删除他人目录"));
}
}

View file

@ -34,6 +34,7 @@ import com.rebuild.core.service.trigger.RobotTriggerManual;
import com.rebuild.core.service.trigger.RobotTriggerObserver;
import com.rebuild.core.support.ConfigurationItem;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.task.TaskExecutors;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@ -42,8 +43,6 @@ import org.springframework.util.Assert;
import java.util.*;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 业务实体核心服务所有业务实体都应该使用此类或子类
* <br>- 有业务验证
@ -399,7 +398,7 @@ public class GeneralEntityService extends ObservableService implements EntitySer
if (state == ApprovalState.APPROVED || state == ApprovalState.PROCESSING) {
throw new DataSpecificationException(state == ApprovalState.APPROVED
? $L("主记录已完成审批,不能添加明细") : $L("主记录正在审批中,不能添加明细"));
? Language.L("主记录已完成审批,不能添加明细") : Language.L("主记录正在审批中,不能添加明细"));
}
}
@ -409,10 +408,10 @@ public class GeneralEntityService extends ObservableService implements EntitySer
if (checkEntity.containsField(EntityHelper.ApprovalId)) {
// 需要验证主记录
String recordType = $L("记录");
String recordType = Language.L("记录");
if (mainEntity != null) {
recordId = getMainId(entity, recordId);
recordType = $L("主记录");
recordType = Language.L("主记录");
}
ApprovalState currentState;
@ -438,11 +437,11 @@ public class GeneralEntityService extends ObservableService implements EntitySer
if (rejected) {
if (RobotTriggerObserver.getTriggerSource() != null) {
recordType = $L("关联记录");
recordType = Language.L("关联记录");
}
throw new DataSpecificationException(currentState == ApprovalState.APPROVED
? $L("%s已完成审批禁止操作", recordType) : $L("%s正在审批中禁止操作", recordType));
? Language.L("%s已完成审批禁止操作", recordType) : Language.L("%s正在审批中禁止操作", recordType));
}
}
}

View file

@ -134,7 +134,7 @@ public class QuickCodeReindexTask extends HeavyTask<Integer> {
nameValue = PickListManager.instance.getLabel((ID) nameValue);
} else if (dt == DisplayType.STATE) {
StateSpec state = StateManager.instance.findState(nameField, nameValue);
nameValue = Language.$L(state);
nameValue = Language.L(state);
} else if (dt == DisplayType.CLASSIFICATION) {
nameValue = ClassificationManager.instance.getFullName((ID) nameValue);
} else if (dt == DisplayType.DATE || dt == DisplayType.DATETIME) {

View file

@ -134,7 +134,7 @@ public class RecycleRestore {
*/
private List<Record> conver2Record(JSONObject content, ID recordId) {
if (!MetadataHelper.containsEntity(recordId.getEntityCode())) {
throw new DefinedException(Language.$L("所属实体已经不存在,无法恢复"));
throw new DefinedException(Language.L("所属实体已经不存在,无法恢复"));
}
JSONArray detailList = content.getJSONArray(RecycleBean.NAME_DETAILLIST);

View file

@ -45,6 +45,6 @@ public abstract class BaseTaskService extends ObservableService {
: ProjectManager.instance.getProject(taskOrProject, null);
if (c != null && c.get("members", Set.class).contains(user)) return true;
throw new DataSpecificationException(Language.$L("非项目成员禁止操作"));
throw new DataSpecificationException(Language.L("非项目成员禁止操作"));
}
}

View file

@ -21,8 +21,6 @@ import com.rebuild.core.support.i18n.Language;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 2020/7/27
@ -73,7 +71,7 @@ public class ProjectCommentService extends BaseTaskService {
private int checkAtUserAndNotification(Record record, String content) {
if (StringUtils.isBlank(content)) return 0;
final String msg = $L("@%s 在任务中提到了你", record.getEditor()) + " \n> " + content;
final String msg = Language.L("@%s 在任务中提到了你", record.getEditor()) + " \n> " + content;
ID[] atUsers = FeedsHelper.findMentions(content);
int send = 0;

View file

@ -20,8 +20,6 @@ import com.rebuild.core.support.i18n.Language;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 项目管理
*
@ -60,7 +58,7 @@ public class ProjectConfigService extends BaseConfigurationService implements Ad
.setParameter(1, projectId)
.unique();
if ((Long) count[0] > 0) {
throw new DataSpecificationException($L("项目下有 %d 个任务,不能删除", count[0]));
throw new DataSpecificationException(Language.L("项目下有 %d 个任务,不能删除", count[0]));
}
return super.delete(projectId);
}
@ -79,9 +77,9 @@ public class ProjectConfigService extends BaseConfigurationService implements Ad
// 使用模板
if (useTemplate == TEMPLATE_DEFAULT) {
ID id1 = createPlan(project.getPrimary(), $L("待处理"), 1000, ProjectPlanConfigService.FLOW_STATUS_START, null);
ID id2 = createPlan(project.getPrimary(), $L("进行中"), 2000, ProjectPlanConfigService.FLOW_STATUS_PROCESSING, null);
ID id3 = createPlan(project.getPrimary(), $L("已完成"), 3000, ProjectPlanConfigService.FLOW_STATUS_END, new ID[]{id1, id2});
ID id1 = createPlan(project.getPrimary(), Language.L("待处理"), 1000, ProjectPlanConfigService.FLOW_STATUS_START, null);
ID id2 = createPlan(project.getPrimary(), Language.L("进行中"), 2000, ProjectPlanConfigService.FLOW_STATUS_PROCESSING, null);
ID id3 = createPlan(project.getPrimary(), Language.L("已完成"), 3000, ProjectPlanConfigService.FLOW_STATUS_END, new ID[]{id1, id2});
updateFlowNexts(id1, new ID[]{id2, id3});
updateFlowNexts(id2, new ID[]{id1, id3});
}

View file

@ -24,8 +24,6 @@ import org.springframework.util.Assert;
import java.util.*;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 项目管理
*
@ -147,7 +145,7 @@ public class ProjectManager implements ConfigManager {
return e.clone();
}
}
throw new ConfigurationException($L("无权访问该项目或项目已删除"));
throw new ConfigurationException(Language.L("无权访问该项目或项目已删除"));
}
/**
@ -174,13 +172,13 @@ public class ProjectManager implements ConfigManager {
}
if (projectId == null) {
throw new ConfigurationException($L("任务不存在或已被删除"));
throw new ConfigurationException(Language.L("任务不存在或已被删除"));
}
try {
return getProject(projectId, user);
} catch (ConfigurationException ex) {
throw new AccessDeniedException($L("无权访问该任务"), ex);
throw new AccessDeniedException(Language.L("无权访问该任务"), ex);
}
}
@ -239,7 +237,7 @@ public class ProjectManager implements ConfigManager {
for (ConfigBean e : getPlansOfProject(projectId)) {
if (e.getID("id").equals(planId)) return e;
}
throw new ConfigurationException($L("无效任务面板 (%s)", planId));
throw new ConfigurationException(Language.L("无效任务面板 (%s)", planId));
}
@Override

View file

@ -14,10 +14,9 @@ import com.rebuild.core.configuration.BaseConfigurationService;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.privileges.AdminGuard;
import com.rebuild.core.service.DataSpecificationException;
import com.rebuild.core.support.i18n.Language;
import org.springframework.stereotype.Service;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 项目/任务面板
*
@ -56,7 +55,7 @@ public class ProjectPlanConfigService extends BaseConfigurationService implement
.setParameter(1, planId)
.unique();
if ((Long) count[0] > 0) {
throw new DataSpecificationException($L("任务面板下有 %d 个任务,不能删除", count[0]));
throw new DataSpecificationException(Language.L("任务面板下有 %d 个任务,不能删除", count[0]));
}
return super.delete(planId);
}

View file

@ -18,10 +18,9 @@ import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.privileges.OperationDeniedException;
import com.rebuild.core.service.notification.Message;
import com.rebuild.core.service.notification.MessageBuilder;
import com.rebuild.core.support.i18n.Language;
import org.springframework.stereotype.Service;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @see ProjectConfigService
@ -184,7 +183,7 @@ public class ProjectTaskService extends BaseTaskService {
*/
private void sendNotification(ID taskId) {
Object[] task = Application.getQueryFactory().uniqueNoFilter(taskId, "executor", "taskName");
String msg = $L("有一个新任务分派给你") + " \n> " + task[1];
String msg = Language.L("有一个新任务分派给你") + " \n> " + task[1];
Application.getNotifications().send(
MessageBuilder.createMessage((ID) task[0], msg, Message.TYPE_PROJECT, taskId));
}

View file

@ -24,6 +24,7 @@ import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.privileges.bizz.Department;
import com.rebuild.core.support.SetUser;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringEscapeUtils;
@ -36,7 +37,6 @@ import java.util.*;
import static cn.devezhao.commons.CalendarUtils.addDay;
import static cn.devezhao.commons.CalendarUtils.addMonth;
import static cn.devezhao.commons.DateFormatUtils.getUTCDateFormat;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 高级查询解析器
@ -127,7 +127,7 @@ public class AdvFilterParser extends SetUser {
String equationHold = equation;
if ((equation = validEquation(equation)) == null) {
throw new FilterParseException($L("无效的高级表达式 : %s", equationHold));
throw new FilterParseException(Language.L("无效的高级表达式 : %s", equationHold));
}
if ("OR".equalsIgnoreCase(equation)) {

View file

@ -13,13 +13,12 @@ import com.rebuild.core.RebuildException;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.service.general.OperatingContext;
import com.rebuild.core.service.general.OperatingObserver;
import com.rebuild.core.support.i18n.Language;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 触发器
*
@ -126,7 +125,7 @@ public class RobotTriggerObserver extends OperatingObserver {
// FIXME 触发器执行失败是否抛出
if (ex instanceof MissingMetaExcetion) {
throw new TriggerException($L("触发器执行失败 : %s", ex.getLocalizedMessage()));
throw new TriggerException(Language.L("触发器执行失败 : %s", ex.getLocalizedMessage()));
} else if (ex instanceof TriggerException) {
throw (TriggerException) ex;
} else {

View file

@ -11,12 +11,11 @@ import com.alibaba.fastjson.JSONObject;
import com.rebuild.core.Application;
import com.rebuild.core.ServerStatus;
import com.rebuild.core.cache.CommonsCache;
import com.rebuild.core.support.i18n.Language;
import java.util.Collection;
import java.util.LinkedHashMap;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 2020/12/7
@ -79,7 +78,7 @@ public class CheckDangers {
if (License.isCommercial() && !License.isRbvAttached()) {
if (dangers == null) dangers = new LinkedHashMap<>();
dangers.put(CommercialNoRbv, $L("系统检测到增值功能包未安装,相关增值功能可能无法使用。请联系 REBUILD 服务人员获取"));
dangers.put(CommercialNoRbv, Language.L("系统检测到增值功能包未安装,相关增值功能可能无法使用。请联系 REBUILD 服务人员获取"));
}
if (dangers == null || dangers.isEmpty()) {
@ -92,7 +91,7 @@ public class CheckDangers {
String hasUpdate = dangers.get(HasUpdate);
if (hasUpdate != null && hasUpdate.contains("$$$$")) {
String[] ss = hasUpdate.split("\\$\\$\\$\\$");
hasUpdate = $L("有新版的 REBUILD (%s) 更新可用 [(查看详情)](%s)", ss[0], ss[1]);
hasUpdate = Language.L("有新版的 REBUILD (%s) 更新可用 [(查看详情)](%s)", ss[0], ss[1]);
hasUpdate = hasUpdate.replace("<a ", "<a target=\"_blank\" ");
dangers.put(HasUpdate, hasUpdate);
}

View file

@ -102,7 +102,7 @@ public class FieldValueHelper {
if (field.getName().equalsIgnoreCase(EntityHelper.ApprovalState)) {
return ApprovalState.DRAFT.getState();
} else if (field.getName().equalsIgnoreCase(EntityHelper.ApprovalId)) {
return wrapMixValue(null, Language.$L(ApprovalState.DRAFT));
return wrapMixValue(null, Language.L(ApprovalState.DRAFT));
}
return null;
@ -160,7 +160,7 @@ public class FieldValueHelper {
return hasValue;
} else if (id.equals(ApprovalStepService.APPROVAL_NOID)) {
return Language.$L("自动审批");
return Language.L("自动审批");
}

View file

@ -32,9 +32,9 @@ public class I18nUtils {
* @param key
* @param placeholders
* @return
* @see Language#$L(String, Object...)
* @see Language#L(String, Object...)
*/
public static String $L(String key, Object... placeholders) {
return Language.$L(key, placeholders);
public static String L(String key, Object... placeholders) {
return Language.L(key, placeholders);
}
}

View file

@ -164,7 +164,7 @@ public class Language implements Initialization {
public Map<String, String> availableLocales() {
Map<String, String> map = new LinkedHashMap<>();
for (Map.Entry<String, LanguageBundle> item : bundleMap.entrySet()) {
map.put(item.getKey(), item.getValue().$L("_"));
map.put(item.getKey(), item.getValue().L("_"));
}
return map;
}
@ -191,26 +191,26 @@ public class Language implements Initialization {
return Application.getLanguage().getBundle(UserContextHolder.getLocale());
}
public static String $L(String key, Object... placeholders) {
return getCurrentBundle().$L(key, placeholders);
public static String L(String key, Object... placeholders) {
return getCurrentBundle().L(key, placeholders);
}
public static String $L(StateSpec state) {
public static String L(StateSpec state) {
String lang = getCurrentBundle().getLang(state.getName());
return lang == null ? state.getName() : lang;
}
public static String $L(DisplayType type) {
public static String L(DisplayType type) {
String lang = getCurrentBundle().getLang(type.getDisplayName());
return lang == null ? type.getDisplayName() : lang;
}
public static String $L(ActionType type) {
public static String L(ActionType type) {
String lang = getCurrentBundle().getLang(type.getDisplayName());
return lang == null ? type.getDisplayName() : lang;
}
public static String $L(BaseMeta meta) {
public static String L(BaseMeta meta) {
String lang = getCurrentBundle().getLang(meta.getDescription());
return lang == null ? meta.getDescription() : lang;
}

View file

@ -157,7 +157,7 @@ public class LanguageBundle implements JSONable {
* @param placeholders
* @return
*/
public String $L(String key, Object... placeholders) {
public String L(String key, Object... placeholders) {
String lang = getLang(key);
if (lang == null) {
log.warn("Missing lang `{}` for `{}`", key, getLocale());
@ -194,7 +194,7 @@ public class LanguageBundle implements JSONable {
return SYS_LC;
}
@Override
public String $L(String key, Object... placeholders) {
public String L(String key, Object... placeholders) {
String lang = getLang(key);
if (lang == null) lang = formatLang(key);
return placeholders.length > 0 ? String.format(lang, placeholders) : lang;

View file

@ -20,6 +20,7 @@ import com.rebuild.core.privileges.UserService;
import com.rebuild.core.support.ConfigurationItem;
import com.rebuild.core.support.License;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.CommonsUtils;
import com.rebuild.utils.HttpUtils;
import lombok.extern.slf4j.Slf4j;
@ -34,8 +35,6 @@ import org.springframework.util.Assert;
import java.util.HashMap;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* SUBMAIL SMS/MAIL 发送
*
@ -87,7 +86,7 @@ public class SMSender {
if (specAccount == null || specAccount.length < 4
|| StringUtils.isBlank(specAccount[0]) || StringUtils.isBlank(specAccount[1])
|| StringUtils.isBlank(specAccount[2]) || StringUtils.isBlank(specAccount[3])) {
throw new ConfigurationException($L("邮件账户未配置或配置错误"));
throw new ConfigurationException(Language.L("邮件账户未配置或配置错误"));
}
// 使用邮件模板
@ -241,7 +240,7 @@ public class SMSender {
if (specAccount == null || specAccount.length < 3
|| StringUtils.isBlank(specAccount[0]) || StringUtils.isBlank(specAccount[1])
|| StringUtils.isBlank(specAccount[2])) {
throw new ConfigurationException($L("短信账户未配置或配置错误"));
throw new ConfigurationException(Language.L("短信账户未配置或配置错误"));
}
Map<String, Object> params = new HashMap<>();

View file

@ -69,7 +69,7 @@ public class StateManager {
StateSpec ss = (StateSpec) c;
JSONObject item = JSONUtils.toJSONObject(
new String[]{"id", "text", "default"},
new Object[]{ss.getState(), Language.$L(ss), ss.isDefault()});
new Object[]{ss.getState(), Language.L(ss), ss.isDefault()});
options.add(item);
}

View file

@ -16,6 +16,7 @@ import com.rebuild.core.Application;
import com.rebuild.core.BootApplication;
import com.rebuild.core.support.ConfigurationItem;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.i18n.LanguageBundle;
import com.rebuild.web.admin.AdminVerfiyController;
import org.apache.commons.lang.StringUtils;
@ -26,8 +27,6 @@ import javax.servlet.http.HttpServletRequest;
import java.nio.file.AccessDeniedException;
import java.sql.DataTruncation;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 封裝一些有用的工具方法
*
@ -137,9 +136,9 @@ public class AppUtils {
Integer code = (Integer) request.getAttribute(ServletUtils.ERROR_STATUS_CODE);
if (code != null && code == 404) {
return $L("访问的页面/资源不存在");
return Language.L("访问的页面/资源不存在");
} else if (code != null && code == 403) {
return $L("权限不足,访问被阻止");
return Language.L("权限不足,访问被阻止");
}
exception = (Throwable) request.getAttribute(ServletUtils.ERROR_EXCEPTION);
@ -149,18 +148,18 @@ public class AppUtils {
if (exception != null) {
Throwable known = ThrowableUtils.getRootCause(exception);
if (known instanceof DataTruncation) {
return $L("字段长度超出限制");
return Language.L("字段长度超出限制");
} else if (known instanceof AccessDeniedException) {
return $L("权限不足,访问被阻止");
return Language.L("权限不足,访问被阻止");
}
}
if (exception == null) {
return $L("系统繁忙,请稍后重试");
return Language.L("系统繁忙,请稍后重试");
} else {
exception = ThrowableUtils.getRootCause(exception);
String errorMsg = exception.getLocalizedMessage();
if (StringUtils.isBlank(errorMsg)) errorMsg = $L("系统繁忙,请稍后重试");
if (StringUtils.isBlank(errorMsg)) errorMsg = Language.L("系统繁忙,请稍后重试");
return errorMsg;
}
}

View file

@ -11,6 +11,7 @@ import cn.devezhao.commons.web.ServletUtils;
import cn.devezhao.persist4j.engine.ID;
import com.alibaba.fastjson.JSON;
import com.rebuild.api.Controller;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.AppUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
@ -20,8 +21,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* Root Controller
*
@ -38,7 +37,7 @@ public abstract class BaseController extends Controller {
protected ID getRequestUser(HttpServletRequest request) {
ID user = AppUtils.getRequestUser(request);
if (user == null) {
throw new InvalidParameterException($L("无效请求用户"));
throw new InvalidParameterException(Language.L("无效请求用户"));
}
return user;
}
@ -119,7 +118,7 @@ public abstract class BaseController extends Controller {
protected String getParameterNotNull(HttpServletRequest request, String name) {
String v = request.getParameter(name);
if (StringUtils.isEmpty(v)) {
throw new InvalidParameterException($L("无效请求参数 (%s=%s)", name, v));
throw new InvalidParameterException(Language.L("无效请求参数 (%s=%s)", name, v));
}
return v;
}
@ -190,7 +189,7 @@ public abstract class BaseController extends Controller {
protected ID getIdParameterNotNull(HttpServletRequest request, String name) {
String v = request.getParameter(name);
if (ID.isId(v)) return ID.valueOf(v);
throw new InvalidParameterException($L("无效请求参数 (%s=%s)", name, v));
throw new InvalidParameterException(Language.L("无效请求参数 (%s=%s)", name, v));
}
/**

View file

@ -8,6 +8,7 @@ See LICENSE and COMMERCIAL in the project root for license information.
package com.rebuild.web;
import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.support.i18n.Language;
import org.apache.commons.lang.StringUtils;
import org.springframework.core.MethodParameter;
import org.springframework.util.Assert;
@ -16,8 +17,6 @@ import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* {@link cn.devezhao.persist4j.Entity} 参数解析器
*
@ -40,7 +39,7 @@ public class EntityParamMethodArgumentResolver implements HandlerMethodArgumentR
String value = webRequest.getParameter(param.name());
if (StringUtils.isBlank(value)) {
if (param.required()) {
throw new InvalidParameterException($L("无效请求参数 (%s=%s)", param.name(), value));
throw new InvalidParameterException(Language.L("无效请求参数 (%s=%s)", param.name(), value));
}
return null;
}
@ -48,6 +47,6 @@ public class EntityParamMethodArgumentResolver implements HandlerMethodArgumentR
if (MetadataHelper.containsEntity(value)) {
return MetadataHelper.getEntity(value);
}
throw new InvalidParameterException($L("无效请求参数"));
throw new InvalidParameterException(Language.L("无效请求参数"));
}
}

View file

@ -39,7 +39,7 @@ public class IdParamMethodArgumentResolver implements HandlerMethodArgumentResol
ID idValue = ID.isId(value) ? ID.valueOf(value) : null;
if (param.required() && idValue == null) {
throw new InvalidParameterException(Language.$L("无效请求参数 (%s=%s)", param.name(), value));
throw new InvalidParameterException(Language.L("无效请求参数 (%s=%s)", param.name(), value));
}
return idValue;
}

View file

@ -149,7 +149,7 @@ public class RebuildWebConfigurer implements WebMvcConfigurer, ErrorViewResolver
if (ex != null && ThrowableUtils.getRootCause(ex) instanceof TemplateInputException
&& errorMsg.contains("Error resolving template")) {
errorMsg = Language.$L("访问的页面/资源不存在");
errorMsg = Language.L("访问的页面/资源不存在");
}
}

View file

@ -16,6 +16,7 @@ import com.rebuild.api.RespBody;
import com.rebuild.core.Application;
import com.rebuild.core.privileges.bizz.User;
import com.rebuild.core.support.CheckDangers;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.web.BaseController;
import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
@ -28,8 +29,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 10/13/2018
@ -49,7 +48,7 @@ public class AdminVerfiyController extends BaseController {
if (admin.isAdmin()) {
return createModelAndView("/admin/admin-verify");
} else {
response.sendError(403, $L("非管理员用户"));
response.sendError(403, Language.L("非管理员用户"));
return null;
}
}

View file

@ -22,6 +22,7 @@ import com.rebuild.core.support.ConfigurationItem;
import com.rebuild.core.support.DataMasking;
import com.rebuild.core.support.License;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.integration.QiniuCloud;
import com.rebuild.core.support.integration.SMSender;
import com.rebuild.utils.CommonsUtils;
@ -41,8 +42,6 @@ import java.util.Comparator;
import java.util.Date;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 系统配置
*
@ -146,7 +145,7 @@ public class ConfigurationController extends BaseController {
return RespBody.ok();
} catch (QiniuException ex) {
return RespBody.error($L("无效配置参数 : %s", ex.response.error));
return RespBody.error(Language.L("无效配置参数 : %s", ex.response.error));
} catch (Exception ex) {
return RespBody.error(ThrowableUtils.getRootCause(ex).getLocalizedMessage());
}
@ -192,7 +191,7 @@ public class ConfigurationController extends BaseController {
specAccount[1] = RebuildConfiguration.get(ConfigurationItem.SmsPassword);
}
String content = $L("收到此消息说明你的短信服务配置正确");
String content = Language.L("收到此消息说明你的短信服务配置正确");
sent = SMSender.sendSMS(receiver, content, specAccount);
} else if ("EMAIL".equalsIgnoreCase(type)) {
@ -209,7 +208,7 @@ public class ConfigurationController extends BaseController {
specAccount[1] = RebuildConfiguration.get(ConfigurationItem.MailPassword);
}
String content = $L("收到此消息说明你的邮件服务配置正确");
String content = Language.L("收到此消息说明你的邮件服务配置正确");
sent = SMSender.sendMail(receiver, content, content, true, specAccount);
}

View file

@ -22,6 +22,7 @@ import com.rebuild.core.privileges.UserService;
import com.rebuild.core.privileges.bizz.Department;
import com.rebuild.core.privileges.bizz.User;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.integration.SMSender;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.EntityController;
@ -40,8 +41,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 10/08/2018
@ -157,8 +156,8 @@ public class UserController extends EntityController {
if (did == null) {
String homeUrl = RebuildConfiguration.getHomeUrl();
String subject = $L("你的账户已激活");
String content = $L("%s 你的账户已激活!现在你可以登陆并使用系统。 [][] 登录地址 : [%s](%s) [][] 首次登陆,建议你立即修改密码!如有任何登陆或使用问题,请与系统管理员联系。",
String subject = Language.L("你的账户已激活");
String content = Language.L("%s 你的账户已激活!现在你可以登陆并使用系统。 [][] 登录地址 : [%s](%s) [][] 首次登陆,建议你立即修改密码!如有任何登陆或使用问题,请与系统管理员联系。",
enUser.getFullName(), homeUrl, homeUrl);
SMSender.sendMailAsync(enUser.getEmail(), subject, content);

View file

@ -26,6 +26,7 @@ import com.rebuild.core.service.dataimport.DataFileParser;
import com.rebuild.core.service.dataimport.DataImporter;
import com.rebuild.core.service.dataimport.ImportRule;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.task.TaskExecutors;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
@ -43,8 +44,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 01/03/2019
@ -65,7 +64,7 @@ public class DataImportController extends BaseController {
String file = getParameterNotNull(request, "file");
File tmp = getFileOfImport(file);
if (tmp == null) {
writeFailure(response, $L("数据文件无效"));
writeFailure(response, Language.L("数据文件无效"));
return;
}
@ -77,7 +76,7 @@ public class DataImportController extends BaseController {
preview = parser.parse(11);
} catch (Exception ex) {
log.error("Parse excel error : " + file, ex);
writeFailure(response, $L("无法解析数据,请检查数据文件格式"));
writeFailure(response, Language.L("无法解析数据,请检查数据文件格式"));
return;
}
@ -136,13 +135,13 @@ public class DataImportController extends BaseController {
String defaultValue = null;
if (EntityHelper.CreatedOn.equals(fieldName)
|| EntityHelper.ModifiedOn.equals(fieldName)) {
defaultValue = $L("当前时间");
defaultValue = Language.L("当前时间");
} else if (EntityHelper.CreatedBy.equals(fieldName)
|| EntityHelper.ModifiedBy.equals(fieldName)
|| EntityHelper.OwningUser.equals(fieldName)) {
defaultValue = $L("当前用户");
defaultValue = Language.L("当前用户");
} else if (easyMeta.getDisplayType() == DisplayType.SERIES) {
defaultValue = $L("自动编号");
defaultValue = Language.L("自动编号");
}
if (defaultValue != null) {

View file

@ -19,6 +19,7 @@ import com.rebuild.core.service.datareport.EasyExcelGenerator;
import com.rebuild.core.service.datareport.TemplateExtractor;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.I18nUtils;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import com.rebuild.web.commons.FileDownloader;
@ -37,8 +38,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* Excel 报表
*
@ -77,7 +76,7 @@ public class ReportTemplateController extends BaseController {
Map<String, String> vars = new TemplateExtractor(template, true).transformVars(entityMeta);
if (vars.isEmpty()) {
writeFailure(response, $L("无效模板文件 (未找到有效字段)"));
writeFailure(response, Language.L("无效模板文件 (未找到有效字段)"));
return;
}
@ -89,7 +88,7 @@ public class ReportTemplateController extends BaseController {
}
if (invalidVars.size() >= vars.size()) {
writeFailure(response, $L("无效模板文件 (未找到有效字段)"));
writeFailure(response, Language.L("无效模板文件 (未找到有效字段)"));
return;
}
@ -110,7 +109,7 @@ public class ReportTemplateController extends BaseController {
entity.getPrimaryField().getName(), entity.getName());
Object[] random = Application.createQueryNoFilter(sql).unique();
if (random == null) {
response.sendError(400, $L("未找到可供预览的记录"));
response.sendError(400, Language.L("未找到可供预览的记录"));
return;
}
@ -119,7 +118,7 @@ public class ReportTemplateController extends BaseController {
File template = DataReportManager.instance.getTemplateFile(entity, reportId);
file = new EasyExcelGenerator(template, (ID) random[0]).generate();
} catch (ConfigurationException ex) {
response.sendError(400, $L("未找到可供预览的记录"));
response.sendError(400, Language.L("未找到可供预览的记录"));
return;
}

View file

@ -14,6 +14,7 @@ import com.rebuild.api.RespBody;
import com.rebuild.core.Application;
import com.rebuild.core.configuration.general.ClassificationService;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import com.rebuild.web.IdParam;
@ -29,8 +30,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 分类数据管理
*
@ -54,7 +53,7 @@ public class ClassificationController extends BaseController {
.setParameter(1, id)
.unique();
if (data == null) {
resp.sendError(404, $L("分类数据不存在"));
resp.sendError(404, Language.L("分类数据不存在"));
return null;
}

View file

@ -25,6 +25,7 @@ import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.rbstore.MetaSchemaGenerator;
import com.rebuild.core.service.general.QuickCodeReindexTask;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.task.TaskExecutors;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
@ -45,8 +46,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author zhaofang123@gmail.com
* @since 08/03/2018
@ -136,16 +135,16 @@ public class MetaEntityController extends BaseController {
String mainEntity = reqJson.getString("mainEntity");
if (StringUtils.isNotBlank(mainEntity)) {
if (!MetadataHelper.containsEntity(mainEntity)) {
writeFailure(response, $L("无效主实体 : %s", mainEntity));
writeFailure(response, Language.L("无效主实体 : %s", mainEntity));
return;
}
Entity useMain = MetadataHelper.getEntity(mainEntity);
if (useMain.getMainEntity() != null) {
writeFailure(response, $L("明细实体不能作为主实体"));
writeFailure(response, Language.L("明细实体不能作为主实体"));
return;
} else if (useMain.getDetailEntity() != null) {
writeFailure(response, $L("选择的主实体已被 [%s] 使用", useMain.getDetailEntity()));
writeFailure(response, Language.L("选择的主实体已被 [%s] 使用", useMain.getDetailEntity()));
return;
}
}

View file

@ -76,7 +76,7 @@ public class MetaFieldController extends BaseController {
map.put("fieldName", easyMeta.getName());
map.put("fieldLabel", easyMeta.getLabel());
map.put("comments", easyMeta.getComments());
map.put("displayType", Language.$L(easyMeta.getDisplayType()));
map.put("displayType", Language.L(easyMeta.getDisplayType()));
map.put("nullable", field.isNullable());
map.put("builtin", easyMeta.isBuiltin());
map.put("creatable", field.isCreatable());

View file

@ -22,6 +22,7 @@ import com.rebuild.core.configuration.general.ViewAddonsManager;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import org.springframework.web.bind.annotation.*;
@ -30,8 +31,6 @@ import javax.servlet.http.HttpServletRequest;
import java.util.HashSet;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 视图-相关项显示
*
@ -95,9 +94,9 @@ public class ViewAddonsController extends BaseController {
}
// 跟进动态
refs.add(new String[] { "Feeds.relatedRecord", $L("动态") });
refs.add(new String[] { "Feeds.relatedRecord", Language.L("动态") });
// 任务项目
refs.add(new String[] { "ProjectTask.relatedRecord", $L("任务") });
refs.add(new String[] { "ProjectTask.relatedRecord", Language.L("任务") });
return JSONUtils.toJSONObject(
new String[] { "config", "refs" },

View file

@ -15,6 +15,7 @@ import com.alibaba.fastjson.JSONObject;
import com.rebuild.api.RespBody;
import com.rebuild.core.Application;
import com.rebuild.core.rbstore.RBStore;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.setup.InstallState;
import com.rebuild.core.support.setup.Installer;
import com.rebuild.utils.AppUtils;
@ -40,8 +41,6 @@ import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 2019/11/25
@ -75,7 +74,7 @@ public class InstallController extends BaseController implements InstallState {
Installer checker = new Installer(props);
try (Connection conn = checker.getConnection(null)) {
DatabaseMetaData dmd = conn.getMetaData();
String okMsg = $L("连接成功 : %s",
String okMsg = Language.L("连接成功 : %s",
dmd.getDatabaseProductName() + " " + dmd.getDatabaseProductVersion());
// 查询表
@ -85,7 +84,7 @@ public class InstallController extends BaseController implements InstallState {
if (hasTable != null) {
// 挂载模式
if (checker.isRbDatabase()) {
okMsg += $L("已发现 **%s** 为 REBUILD 数据库,系统将自动挂载", dbProps.getString("dbName"));
okMsg += Language.L("已发现 **%s** 为 REBUILD 数据库,系统将自动挂载", dbProps.getString("dbName"));
okMsg = "1#" + okMsg;
} else {
return RespBody.errorl("非空数据库不可使用,请使用其他数据库");
@ -99,7 +98,7 @@ public class InstallController extends BaseController implements InstallState {
} catch (SQLException ex) {
if (ex.getLocalizedMessage().contains("Unknown database")) {
String okMsg = $L("连接成功 : 数据库 **%s** 不存在,系统将自动创建", dbProps.getString("dbName"));
String okMsg = Language.L("连接成功 : 数据库 **%s** 不存在,系统将自动创建", dbProps.getString("dbName"));
return RespBody.ok(okMsg);
} else {
return RespBody.errorl("连接错误 : %s", ex.getLocalizedMessage());
@ -124,7 +123,7 @@ public class InstallController extends BaseController implements InstallState {
}
pool.destroy();
return RespBody.ok($L("连接成功 : %s", info));
return RespBody.ok(Language.L("连接成功 : %s", info));
} catch (Exception ex) {
return RespBody.errorl("连接错误 : %s", ThrowableUtils.getRootCause(ex).getLocalizedMessage());

View file

@ -11,6 +11,7 @@ import cn.devezhao.commons.web.ServletUtils;
import com.alibaba.fastjson.JSONObject;
import com.rebuild.core.Application;
import com.rebuild.core.ServerStatus;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.AppUtils;
import com.rebuild.web.BaseController;
import org.springframework.stereotype.Controller;
@ -20,8 +21,6 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author zhaofang123@gmail.com
* @see com.rebuild.web.RebuildWebConfigurer
@ -35,7 +34,7 @@ public class ErrorPageView extends BaseController {
ModelAndView mv = createModelAndView("/error/error");
mv.getModelMap().put("error_code", 400);
mv.getModelMap().put("error_msg",
$L("不支持 IE10 及以下的浏览器 [] 推荐使用 Edge、Chrome、Firefox 或 IE11"));
Language.L("不支持 IE10 及以下的浏览器 [] 推荐使用 Edge、Chrome、Firefox 或 IE11"));
return mv;
}

View file

@ -16,6 +16,7 @@ import com.rebuild.core.RebuildException;
import com.rebuild.core.privileges.UserService;
import com.rebuild.core.support.CsrfToken;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.integration.QiniuCloud;
import com.rebuild.utils.AppUtils;
import com.rebuild.utils.RbAssert;
@ -37,8 +38,6 @@ import java.awt.image.BufferedImage;
import java.io.*;
import java.nio.charset.StandardCharsets;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 文件下载/查看
*
@ -141,7 +140,7 @@ public class FileDownloader extends BaseController {
if (request.getRequestURI().contains("/filex/access/")) {
String e = getParameter(request, "e");
if (StringUtils.isBlank(e) || Application.getCommonsCache().get(e) == null) {
response.sendError(HttpStatus.FORBIDDEN.value(), $L("分享的文件已过期"));
response.sendError(HttpStatus.FORBIDDEN.value(), Language.L("分享的文件已过期"));
return;
}

View file

@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSON;
import com.rebuild.core.Application;
import com.rebuild.core.support.ConfigurationItem;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.integration.QiniuCloud;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
@ -27,8 +28,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collections;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 文件共享
*
@ -53,7 +52,7 @@ public class FileShareController extends BaseController {
public JSON makeSharedFile(HttpServletRequest request) {
Assert.isTrue(
RebuildConfiguration.getBool(ConfigurationItem.FileSharable),
$L("不允许分享文件"));
Language.L("不允许分享文件"));
String fileUrl = getParameterNotNull(request, "url");
int mtime = getIntParameter(request, "time", 5);
@ -71,7 +70,7 @@ public class FileShareController extends BaseController {
String fileUrl;
if (!RebuildConfiguration.getBool(ConfigurationItem.FileSharable)
|| (fileUrl = Application.getCommonsCache().get(shareKey)) == null) {
response.sendError(403, $L("分享的文件已过期"));
response.sendError(403, Language.L("分享的文件已过期"));
return null;
}

View file

@ -11,6 +11,7 @@ import cn.devezhao.commons.ObjectUtils;
import com.rebuild.api.RespBody;
import com.rebuild.core.service.files.FilesHelper;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.integration.QiniuCloud;
import com.rebuild.web.BaseController;
import lombok.extern.slf4j.Slf4j;
@ -29,8 +30,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 文件上传
*
@ -75,7 +74,7 @@ public class FileUploader extends BaseController {
file.transferTo(dest);
if (!dest.exists()) {
writeFailure(response, $L("上传失败,请稍后重试"));
writeFailure(response, Language.L("上传失败,请稍后重试"));
return;
}
@ -87,7 +86,7 @@ public class FileUploader extends BaseController {
if (uploadName != null) {
writeSuccess(response, uploadName);
} else {
writeFailure(response, $L("上传失败,请稍后重试"));
writeFailure(response, Language.L("上传失败,请稍后重试"));
}
}

View file

@ -88,7 +88,7 @@ public class MetadataGetting extends BaseController {
// if ("VF_USER_TEAMS".equalsIgnoreCase(getParameter(request, "extra"))) {
// final JSONObject temp = JSONUtils.toJSONObject(
// new String[] { "name", "label", "type", "ref" },
// new Object[] { null, "." + Language.L("JoinedTeams"), "REFERENCE", new String[] { "Team", "TEXT" } });
// new Object[] { null, "." + Language.L("加入团队"), "REFERENCE", new String[] { "Team", "TEXT" } });
//
// List<JSONObject> dataNew = new ArrayList<>();
// for (JSONObject item : data) {

View file

@ -19,6 +19,7 @@ import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.privileges.RoleService;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.privileges.bizz.ZeroEntry;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.RbAssert;
import com.rebuild.web.BaseController;
import org.apache.commons.lang.StringUtils;
@ -30,8 +31,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 导航菜单设置
*
@ -47,7 +46,7 @@ public class NavSettings extends BaseController implements ShareTo {
final ID user = getRequestUser(request);
RbAssert.isAllow(
Application.getPrivilegesManager().allow(user, ZeroEntry.AllowCustomNav),
$L("无操作权限"));
Language.L("无操作权限"));
ID cfgid = getIdParameter(request, "id");
// 普通用户只能有一个

View file

@ -27,6 +27,7 @@ import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.privileges.RoleService;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.privileges.bizz.ZeroEntry;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.RbAssert;
import com.rebuild.web.BaseController;
@ -44,8 +45,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 列表配置
*
@ -62,7 +61,7 @@ public class ShowFieldsController extends BaseController implements ShareTo {
final ID user = getRequestUser(request);
RbAssert.isAllow(
Application.getPrivilegesManager().allow(user, ZeroEntry.AllowCustomDataList),
$L("无操作权限"));
Language.L("无操作权限"));
ID cfgid = getIdParameter(request, "id");
// 普通用户只能有一个

View file

@ -29,6 +29,7 @@ import com.rebuild.core.service.dashboard.ChartConfigService;
import com.rebuild.core.service.dashboard.DashboardConfigService;
import com.rebuild.core.service.dashboard.charts.ChartData;
import com.rebuild.core.service.dashboard.charts.ChartsFactory;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.RbAssert;
import com.rebuild.web.EntityController;
@ -47,8 +48,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 12/09/2018
@ -64,7 +63,7 @@ public class ChartDesignController extends EntityController {
final ID user = getRequestUser(request);
RbAssert.isAllow(
Application.getPrivilegesManager().allow(user, ZeroEntry.AllowCustomChart),
$L("无操作权限"));
Language.L("无操作权限"));
ModelAndView mv = createModelAndView("/dashboard/chart-design");
@ -74,11 +73,11 @@ public class ChartDesignController extends EntityController {
.setParameter(1, chartId)
.unique();
if (chart == null) {
response.sendError(404, $L("未知图表"));
response.sendError(404, Language.L("未知图表"));
return null;
}
if (!UserHelper.isAdmin(user) && !user.equals(chart[3])) {
response.sendError(403, $L("无权操作他人图表"));
response.sendError(403, Language.L("无权操作他人图表"));
return null;
}
@ -93,11 +92,11 @@ public class ChartDesignController extends EntityController {
mv.getModel().put("chartOwningAdmin", UserHelper.isAdmin(user));
} else {
throw new InvalidParameterException($L("无效请求参数"));
throw new InvalidParameterException(Language.L("无效请求参数"));
}
if (!Application.getPrivilegesManager().allowRead(getRequestUser(request), entity.getEntityCode())) {
response.sendError(403, $L("没有读取 %s 的权限", EasyMetaFactory.getLabel(entity)));
response.sendError(403, Language.L("没有读取 %s 的权限", EasyMetaFactory.getLabel(entity)));
return null;
}

View file

@ -153,7 +153,7 @@ public class DashboardController extends BaseController {
for (BuiltinChart b : ChartsFactory.getBuiltinCharts()) {
charts.add(JSONUtils.toJSONObject(
new String[] { "id", "title", "type", "entityLabel" },
new Object[] { b.getChartId(), b.getChartTitle(), b.getChartType(), Language.$L("内置") }));
new Object[] { b.getChartId(), b.getChartTitle(), b.getChartType(), Language.L("内置") }));
}
}

View file

@ -7,14 +7,13 @@ See LICENSE and COMMERCIAL in the project root for license information.
package com.rebuild.web.extform;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.RbAssert;
import com.rebuild.web.BaseController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao
* @since 2020/12/8
@ -24,7 +23,7 @@ public class ExtformAdminController extends BaseController {
@GetMapping("/admin/extforms")
public ModelAndView pageList() {
RbAssert.isCommercial($L("免费版不支持外部表单功能 [(查看详情)](https://getrebuild.com/docs/rbv-features)"));
RbAssert.isCommercial(Language.L("免费版不支持外部表单功能 [(查看详情)](https://getrebuild.com/docs/rbv-features)"));
return createModelAndView("/admin/extform/extform-list");
}
}

View file

@ -17,6 +17,7 @@ import com.rebuild.api.RespBody;
import com.rebuild.core.Application;
import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.service.feeds.FeedsType;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import com.rebuild.web.IdParam;
@ -26,8 +27,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 操作相关
*
@ -84,7 +83,7 @@ public class FeedsPostController extends BaseController {
.setParameter(2, FeedsType.SCHEDULE.getMask())
.unique();
if (schedule == null || !schedule[0].equals(user)) {
return RespBody.error($L("无操作权限"));
return RespBody.error(Language.L("无操作权限"));
}
// 非结构化存储

View file

@ -226,7 +226,7 @@ public class FileListController extends BaseController {
private JSONObject formatEntityJson(Entity entity) {
return JSONUtils.toJSONObject(
new String[] { "id", "text" },
new Object[] { entity.getEntityCode(), Language.$L(entity) });
new Object[] { entity.getEntityCode(), Language.L(entity) });
}
private boolean hasAttachmentFields(Entity entity) {

View file

@ -26,6 +26,7 @@ import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.metadata.impl.EasyFieldConfigProps;
import com.rebuild.core.privileges.bizz.ZeroEntry;
import com.rebuild.core.service.general.BulkContext;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.state.StateManager;
import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.RbAssert;
@ -36,8 +37,6 @@ import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 批量修改
*
@ -53,7 +52,7 @@ public class BatchUpdateController extends BaseController {
final ID user = getRequestUser(request);
RbAssert.isAllow(
Application.getPrivilegesManager().allow(user, ZeroEntry.AllowBatchUpdate),
$L("无操作权限"));
Language.L("无操作权限"));
JSONObject requestData = (JSONObject) ServletUtils.getRequestJson(request);
@ -118,10 +117,10 @@ public class BatchUpdateController extends BaseController {
JSONArray options = new JSONArray();
options.add(JSONUtils.toJSONObject(
new String[] { "id", "text" },
new Object[] { true, $L("") }));
new Object[] { true, Language.L("") }));
options.add(JSONUtils.toJSONObject(
new String[] { "id", "text" },
new Object[] { false, $L("") }));
new Object[] { false, Language.L("") }));
map.put("options", options);
} else if (dt == DisplayType.NUMBER) {

View file

@ -18,6 +18,7 @@ import com.rebuild.core.metadata.MetadataHelper;
import com.rebuild.core.privileges.bizz.ZeroEntry;
import com.rebuild.core.support.general.DataListBuilder;
import com.rebuild.core.support.general.DataListBuilderImpl;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.web.EntityController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@ -26,8 +27,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 数据列表
*
@ -96,7 +95,7 @@ public class GeneralListController extends EntityController {
}
if (!Application.getPrivilegesManager().allowRead(user, checkEntity.getEntityCode())) {
response.sendError(403, $L("你没有访问此页面的权限"));
response.sendError(403, Language.L("你没有访问此页面的权限"));
return null;
}

View file

@ -32,6 +32,7 @@ import com.rebuild.core.service.general.BulkContext;
import com.rebuild.core.service.general.EntityService;
import com.rebuild.core.support.general.FieldValueHelper;
import com.rebuild.core.support.i18n.I18nUtils;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import com.rebuild.web.IdParam;
@ -48,8 +49,6 @@ import javax.servlet.http.HttpServletRequest;
import java.sql.DataTruncation;
import java.util.*;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 业务实体操作///分派/共享
*
@ -89,7 +88,7 @@ public class GeneralOperatingController extends BaseController {
// 检查重复值
List<Record> repeated = ies.getAndCheckRepeated(record, 100);
if (!repeated.isEmpty()) {
return new RespBody(CODE_REPEATED_VALUES, $L("存在重复记录"), buildRepeatedData(repeated));
return new RespBody(CODE_REPEATED_VALUES, Language.L("存在重复记录"), buildRepeatedData(repeated));
}
try {
@ -379,7 +378,7 @@ public class GeneralOperatingController extends BaseController {
sameEntityCode = id0.getEntityCode();
}
if (sameEntityCode != id0.getEntityCode()) {
throw new InvalidParameterException($L("只能批量处理同一实体的记录"));
throw new InvalidParameterException(Language.L("只能批量处理同一实体的记录"));
}
idList.add(ID.valueOf(id));
}

View file

@ -23,6 +23,7 @@ import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.privileges.bizz.User;
import com.rebuild.core.service.general.transform.RecordTransfomer;
import com.rebuild.core.support.i18n.I18nUtils;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import com.rebuild.web.EntityParam;
@ -36,8 +37,6 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 表单/视图 功能扩展
*
@ -69,7 +68,7 @@ public class ModelExtrasController extends BaseController {
RecordTransfomer transfomer = new RecordTransfomer(targetEntity, (JSONObject) config.getJSON("config"));
if (!transfomer.checkFilter(sourceRecord)) {
return RespBody.error($L("当前记录不符合转换条件"), 400);
return RespBody.error(Language.L("当前记录不符合转换条件"), 400);
}
ID newId = transfomer.transform(sourceRecord);
@ -146,13 +145,13 @@ public class ModelExtrasController extends BaseController {
for (Object[] o : array) {
int revType = (int) o[0];
if (revType == 1) o[0] = $L("新建");
else if (revType == 2) o[0] = $L("删除");
else if (revType == 4) o[0] = $L("更新");
else if (revType == 16) o[0] = $L("分派");
else if (revType == 32) o[0] = $L("共享");
else if (revType == 64) o[0] = $L("取消共享");
else o[0] = $L("未知");
if (revType == 1) o[0] = Language.L("新建");
else if (revType == 2) o[0] = Language.L("删除");
else if (revType == 4) o[0] = Language.L("更新");
else if (revType == 16) o[0] = Language.L("分派");
else if (revType == 32) o[0] = Language.L("共享");
else if (revType == 64) o[0] = Language.L("取消共享");
else o[0] = Language.L("未知");
o[1] = I18nUtils.formatDate((Date) o[1]);
o[2] = new Object[] { o[2], UserHelper.getName((ID) o[2]) };

View file

@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONObject;
import com.rebuild.api.RespBody;
import com.rebuild.core.service.general.RecentlyUsedHelper;
import com.rebuild.core.support.general.FieldValueHelper;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import org.apache.commons.lang.StringUtils;
@ -24,8 +25,6 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 最近搜索针对引用字段
* 非自动需要调用 <tt>recently-add</tt> 方法手动添加方可用后期考虑自动化
@ -43,7 +42,7 @@ public class RecentlyUsedSearchController extends BaseController {
String type = getParameter(request, "type");
ID[] recently = RecentlyUsedHelper.gets(getRequestUser(request), entity, type);
return formatSelect2(recently, $L("最近使用"));
return formatSelect2(recently, Language.L("最近使用"));
}
@PostMapping("recently-add")

View file

@ -20,6 +20,7 @@ import com.rebuild.core.service.dataimport.DataExporter;
import com.rebuild.core.service.datareport.DataReportManager;
import com.rebuild.core.service.datareport.EasyExcelGenerator;
import com.rebuild.core.support.general.BatchOperatorQuery;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.utils.RbAssert;
import com.rebuild.web.BaseController;
@ -35,8 +36,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 报表/导出
*
@ -85,7 +84,7 @@ public class ReportsController extends BaseController {
final ID user = getRequestUser(request);
RbAssert.isAllow(
Application.getPrivilegesManager().allow(user, ZeroEntry.AllowDataExport),
$L("无操作权限"));
Language.L("无操作权限"));
int dataRange = getIntParameter(request, "dr", BatchOperatorQuery.DR_PAGED);
JSONObject queryData = (JSONObject) ServletUtils.getRequestJson(request);

View file

@ -119,7 +119,7 @@ public class ProjectController extends BaseController {
// 未找到就跳转到第一个项目
ConfigBean[] ccc = ProjectManager.instance.getAvailable(getRequestUser(request));
if (ccc.length == 0) {
response.sendError(404, Language.$L("没有可用项目"));
response.sendError(404, Language.L("没有可用项目"));
} else {
String projectUrl = baseUrl + ccc[0].getID("id") + "/tasks#gs=";
if (gs != null) projectUrl += CodecUtils.urlEncode(gs);

View file

@ -22,6 +22,7 @@ import com.rebuild.core.service.project.ProjectManager;
import com.rebuild.core.service.query.AdvFilterParser;
import com.rebuild.core.support.general.FieldValueHelper;
import com.rebuild.core.support.i18n.I18nUtils;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import com.rebuild.web.IdParam;
@ -40,8 +41,6 @@ import java.io.IOException;
import java.util.Date;
import java.util.Set;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 任务
*
@ -67,7 +66,7 @@ public class ProjectTaskController extends BaseController {
final ID user = getRequestUser(request);
if (!ProjectHelper.checkReadable(taskId2, user)) {
response.sendError(403, $L("你无权查看此任务"));
response.sendError(403, Language.L("你无权查看此任务"));
return null;
}
@ -230,7 +229,7 @@ public class ProjectTaskController extends BaseController {
public JSON relatedTaskList(@IdParam(name = "related", required = false) ID relatedId,
@IdParam(name = "task", required = false) ID taskId,
HttpServletRequest request) {
Assert.isTrue(relatedId != null || taskId != null, $L("无效请求参数"));
Assert.isTrue(relatedId != null || taskId != null, Language.L("无效请求参数"));
String queryWhere = String.format("relatedRecord = '%s'", relatedId);
// 关键词搜索

View file

@ -24,6 +24,7 @@ import com.rebuild.core.metadata.easymeta.EasyMetaFactory;
import com.rebuild.core.privileges.UserHelper;
import com.rebuild.core.service.approval.ApprovalHelper;
import com.rebuild.core.service.approval.RobotApprovalConfigService;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import com.rebuild.web.EntityParam;
@ -37,8 +38,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao zhaofang123@gmail.com
* @since 2019/06/24
@ -61,7 +60,7 @@ public class ApprovalAdminController extends BaseController {
.setParameter(1, configId)
.unique();
if (config == null) {
response.sendError(404, $L("审批流程不存在"));
response.sendError(404, Language.L("审批流程不存在"));
return null;
}
@ -116,8 +115,8 @@ public class ApprovalAdminController extends BaseController {
@GetMapping("approval/user-fields")
public JSON approvalUserFields(@EntityParam Entity entity) {
final String textSubmitor = $L("发起人") + ".";
final String textApprover = $L("审批人") + ".";
final String textSubmitor = Language.L("发起人") + ".";
final String textApprover = Language.L("审批人") + ".";
List<String[]> fields = new ArrayList<>();
@ -158,8 +157,8 @@ public class ApprovalAdminController extends BaseController {
public JSON approvalUserFieldsShow(@EntityParam Entity entity, HttpServletRequest request) {
final JSON users = ServletUtils.getRequestJson(request);
final String textSubmitor = $L("发起人") + ".";
final String textApprover = $L("审批人") + ".";
final String textSubmitor = Language.L("发起人") + ".";
final String textApprover = Language.L("审批人") + ".";
List<String[]> shows = new ArrayList<>();

View file

@ -1,5 +1,4 @@
/*
Copyright (c) REBUILD <https://getrebuild.com/> and/or its owners. All rights reserved.
/*Copyright (c) REBUILD <https://getrebuild.com/> and/or its owners. All rights reserved.
rebuild is dual-licensed under commercial and open source licenses (GPLv3).
See LICENSE and COMMERCIAL in the project root for license information.
@ -9,7 +8,6 @@ package com.rebuild.web.robot.trigger;
import com.alibaba.fastjson.JSON;
import com.rebuild.core.Application;
import com.rebuild.core.service.approval.RobotApprovalManager;
import com.rebuild.utils.JSONUtils;
import com.rebuild.web.BaseController;
import org.springframework.web.bind.annotation.RequestMapping;

View file

@ -33,8 +33,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author devezhao zhaofang123@gmail.com
* @since 2019/05/23
@ -69,7 +67,7 @@ public class TriggerAdminController extends BaseController {
mv.getModel().put("sourceEntity", sourceEntity.getName());
mv.getModel().put("sourceEntityLabel", EasyMetaFactory.getLabel(sourceEntity));
mv.getModel().put("actionType", actionType.name());
mv.getModel().put("actionTypeLabel", $L(actionType));
mv.getModel().put("actionTypeLabel", Language.L(actionType));
mv.getModel().put("when", config[2]);
mv.getModel().put("whenTimer", config[7] == null ? StringUtils.EMPTY : config[7]);
mv.getModel().put("whenFilter", StringUtils.defaultIfBlank((String) config[3], JSONUtils.EMPTY_OBJECT_STR));
@ -83,7 +81,7 @@ public class TriggerAdminController extends BaseController {
public List<String[]> getAvailableActions() {
List<String[]> alist = new ArrayList<>();
for (ActionType t : ActionFactory.getAvailableActions()) {
alist.add(new String[] { t.name(), $L(t) });
alist.add(new String[] { t.name(), Language.L(t) });
}
return alist;
}
@ -112,7 +110,7 @@ public class TriggerAdminController extends BaseController {
Object[][] array = ReportTemplateController.queryListOfConfig(sql, belongEntity, q);
for (Object[] o : array) {
o[7] = $L(ActionType.valueOf((String) o[7]));
o[7] = Language.L(ActionType.valueOf((String) o[7]));
}
return array;
}

View file

@ -16,6 +16,7 @@ import com.rebuild.core.metadata.EntityHelper;
import com.rebuild.core.privileges.UserService;
import com.rebuild.core.support.VerfiyCode;
import com.rebuild.core.support.i18n.I18nUtils;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.integration.SMSender;
import com.rebuild.web.EntityController;
import org.apache.commons.lang.StringUtils;
@ -27,8 +28,6 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 用户设置
*
@ -59,7 +58,7 @@ public class UserSettings extends EntityController {
String vcode = VerfiyCode.generate(email);
String subject = "邮箱验证码";
String content = $L("你的邮箱验证码是 : **%s**", vcode);
String content = Language.L("你的邮箱验证码是 : **%s**", vcode);
String sentid = SMSender.sendMail(email, subject, content);
if (sentid != null) {

View file

@ -27,6 +27,7 @@ import com.rebuild.core.privileges.UserService;
import com.rebuild.core.privileges.bizz.User;
import com.rebuild.core.service.DataSpecificationException;
import com.rebuild.core.support.*;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.integration.SMSender;
import com.rebuild.utils.AES;
import com.rebuild.utils.AppUtils;
@ -48,8 +49,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* @author zhaofang123@gmail.com
* @since 07/25/2018
@ -280,8 +279,8 @@ public class LoginController extends BaseController {
}
String vcode = VerfiyCode.generate(email, 2);
String subject = $L("重置密码");
String content = $L("你的重置密码验证码是 : **%s**", vcode);
String subject = Language.L("重置密码");
String content = Language.L("你的重置密码验证码是 : **%s**", vcode);
String sentid = SMSender.sendMail(email, subject, content);
if (sentid != null) {

View file

@ -20,6 +20,7 @@ import com.rebuild.core.service.DataSpecificationException;
import com.rebuild.core.support.ConfigurationItem;
import com.rebuild.core.support.RebuildConfiguration;
import com.rebuild.core.support.VerfiyCode;
import com.rebuild.core.support.i18n.Language;
import com.rebuild.core.support.integration.SMSender;
import com.rebuild.utils.BlockList;
import com.rebuild.web.BaseController;
@ -37,8 +38,6 @@ import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.io.IOException;
import static com.rebuild.core.support.i18n.Language.$L;
/**
* 用户自助注册
*
@ -53,7 +52,7 @@ public class SignUpController extends BaseController {
@GetMapping("signup")
public ModelAndView pageSignup(HttpServletResponse response) throws IOException {
if (!RebuildConfiguration.getBool(ConfigurationItem.OpenSignUp)) {
response.sendError(400, $L("管理员未开放公开注册"));
response.sendError(400, Language.L("管理员未开放公开注册"));
return null;
}
return createModelAndView("/signup/signup");
@ -74,8 +73,8 @@ public class SignUpController extends BaseController {
}
String vcode = VerfiyCode.generate(email, 1);
String title = $L("注册验证码");
String content = $L("你的注册验证码是 : **%s**", vcode);
String title = Language.L("注册验证码");
String content = Language.L("你的注册验证码是 : **%s**", vcode);
String sentid = SMSender.sendMail(email, title, content);
@ -113,8 +112,8 @@ public class SignUpController extends BaseController {
// 通知用户
String homeUrl = RebuildConfiguration.getHomeUrl();
String title = $L("管理员正在审核你的注册信息");
String content = $L(
String title = Language.L("管理员正在审核你的注册信息");
String content = Language.L(
"%s 欢迎注册!以下是你的注册信息,请妥善保管。 [][] 登录账号 : **%s** [] 登录密码 : **%s** [] 登录地址 : [%s](%s) [][] 目前你还无法登录系统,因为系统管理员正在审核你的注册信息。完成后会通过邮件通知你,请耐心等待。",
fullName, loginName, passwd, homeUrl, homeUrl);
SMSender.sendMail(email, title, content);

View file

@ -6,20 +6,20 @@
<div class="left-sidebar-scroll rb-scroller">
<div class="left-sidebar-content">
<ul class="sidebar-elements">
<li class="divider">[[${bundle.$L('系统')}]]</li>
<li class="divider">[[${bundle.L('系统')}]]</li>
<li th:class="${active == 'systems'} ? 'active'">
<a th:href="@{/admin/systems}"><i class="icon zmdi zmdi-settings"></i><span>[[${bundle.$L('通用配置')}]]</span></a>
<a th:href="@{/admin/systems}"><i class="icon zmdi zmdi-settings"></i><span>[[${bundle.L('通用配置')}]]</span></a>
</li>
<li class="parent">
<a><i class="icon zmdi zmdi-puzzle-piece"></i><span>[[${bundle.$L('服务集成')}]]</span></a>
<a><i class="icon zmdi zmdi-puzzle-piece"></i><span>[[${bundle.L('服务集成')}]]</span></a>
<ul class="sub-menu">
<li class="title">[[${bundle.$L('服务集成')}]]</li>
<li class="title">[[${bundle.L('服务集成')}]]</li>
<li class="nav-items">
<div class="rb-scroller">
<div class="content">
<ul>
<li th:class="${active == 'integration-storage'} ? 'active'"><a th:href="@{/admin/integration/storage}">[[${bundle.$L('云存储')}]]</a></li>
<li th:class="${active == 'integration-submail'} ? 'active'"><a th:href="@{/admin/integration/submail}">[[${bundle.$L('邮件&短信')}]]</a></li>
<li th:class="${active == 'integration-storage'} ? 'active'"><a th:href="@{/admin/integration/storage}">[[${bundle.L('云存储')}]]</a></li>
<li th:class="${active == 'integration-submail'} ? 'active'"><a th:href="@{/admin/integration/submail}">[[${bundle.L('邮件&短信')}]]</a></li>
</ul>
</div>
</div>
@ -27,56 +27,56 @@
</ul>
</li>
<li th:class="${active == 'apis-manager'} ? 'active'">
<a th:href="@{/admin/apis-manager}"><i class="icon zmdi zmdi-key"></i><span>[[${bundle.$L('API 秘钥')}]]</span></a>
<a th:href="@{/admin/apis-manager}"><i class="icon zmdi zmdi-key"></i><span>[[${bundle.L('API 秘钥')}]]</span></a>
</li>
<li class="divider">[[${bundle.$L('业务实体')}]]</li>
<li class="divider">[[${bundle.L('业务实体')}]]</li>
<li th:class="${active == 'entities'} ? 'active'">
<a th:href="@{/admin/entities}"><i class="icon zmdi zmdi-widgets"></i><span>[[${bundle.$L('实体管理')}]]</span></a>
<a th:href="@{/admin/entities}"><i class="icon zmdi zmdi-widgets"></i><span>[[${bundle.L('实体管理')}]]</span></a>
</li>
<li th:class="${active == 'classifications'} ? 'active'">
<a th:href="@{/admin/metadata/classifications}"><i class="icon zmdi zmdi-layers"></i><span>[[${bundle.$L('分类数据')}]]</span></a>
<a th:href="@{/admin/metadata/classifications}"><i class="icon zmdi zmdi-layers"></i><span>[[${bundle.L('分类数据')}]]</span></a>
</li>
<li th:class="${active == 'robot-approval'} ? 'active'">
<a th:href="@{/admin/robot/approvals}"><i class="icon zmdi zmdi-assignment-check"></i><span>[[${bundle.$L('审批流程')}]]</span></a>
<a th:href="@{/admin/robot/approvals}"><i class="icon zmdi zmdi-assignment-check"></i><span>[[${bundle.L('审批流程')}]]</span></a>
</li>
<li th:class="${active == 'transforms'} ? 'active'">
<a th:href="@{/admin/transforms}"><i class="icon zmdi zmdi-transform"></i><span>[[${bundle.$L('记录转换映射')}]]</span></a>
<a th:href="@{/admin/transforms}"><i class="icon zmdi zmdi-transform"></i><span>[[${bundle.L('记录转换映射')}]]</span></a>
</li>
<li th:class="${active == 'robot-trigger'} ? 'active'">
<a th:href="@{/admin/robot/triggers}"><i class="icon zmdi zmdi-rotate-cw"></i><span>[[${bundle.$L('触发器')}]]</span></a>
<a th:href="@{/admin/robot/triggers}"><i class="icon zmdi zmdi-rotate-cw"></i><span>[[${bundle.L('触发器')}]]</span></a>
</li>
<li th:class="${active == 'data-imports'} ? 'active'">
<a th:href="@{/admin/data/data-imports}"><i class="icon zmdi zmdi-cloud-upload"></i><span>[[${bundle.$L('数据导入')}]]</span></a>
<a th:href="@{/admin/data/data-imports}"><i class="icon zmdi zmdi-cloud-upload"></i><span>[[${bundle.L('数据导入')}]]</span></a>
</li>
<li th:class="${active == 'report-templates'} ? 'active'">
<a th:href="@{/admin/data/report-templates}"><i class="icon zmdi zmdi-map"></i><span>[[${bundle.$L('报表模板')}]]</span></a>
<a th:href="@{/admin/data/report-templates}"><i class="icon zmdi zmdi-map"></i><span>[[${bundle.L('报表模板')}]]</span></a>
</li>
<li class="divider">[[${bundle.$L('高级功能')}]]</li>
<li class="divider">[[${bundle.L('高级功能')}]]</li>
<li th:class="${active == 'projects'} ? 'active'">
<a th:href="@{/admin/projects}"><i class="icon zmdi zmdi-shape"></i><span>[[${bundle.$L('项目')}]]</span></a>
<a th:href="@{/admin/projects}"><i class="icon zmdi zmdi-shape"></i><span>[[${bundle.L('项目')}]]</span></a>
</li>
<li th:class="${active == 'extforms'} ? 'active'">
<a th:href="@{/admin/extforms}"><i class="icon zmdi zmdi-collection-text"></i><span>[[${bundle.$L('外部表单')}]]</span> <sup class="rbv"></sup></a>
<a th:href="@{/admin/extforms}"><i class="icon zmdi zmdi-collection-text"></i><span>[[${bundle.L('外部表单')}]]</span> <sup class="rbv"></sup></a>
</li>
<li class="divider">[[${bundle.$L('用户')}]]</li>
<li class="divider">[[${bundle.L('用户')}]]</li>
<li th:class="${active == 'users'} ? 'active'">
<a th:href="@{/admin/bizuser/users}"><i class="icon zmdi zmdi-accounts"></i><span>[[${bundle.$L('部门用户')}]]</span></a>
<a th:href="@{/admin/bizuser/users}"><i class="icon zmdi zmdi-accounts"></i><span>[[${bundle.L('部门用户')}]]</span></a>
</li>
<li th:class="${active == 'role-privileges'} ? 'active'">
<a th:href="@{/admin/bizuser/role-privileges}"><i class="icon zmdi zmdi-lock"></i><span>[[${bundle.$L('角色权限')}]]</span></a>
<a th:href="@{/admin/bizuser/role-privileges}"><i class="icon zmdi zmdi-lock"></i><span>[[${bundle.L('角色权限')}]]</span></a>
</li>
<li th:class="${active == 'teams'} ? 'active'">
<a th:href="@{/admin/bizuser/teams}"><i class="icon zmdi zmdi-case"></i><span>[[${bundle.$L('团队')}]]</span></a>
<a th:href="@{/admin/bizuser/teams}"><i class="icon zmdi zmdi-case"></i><span>[[${bundle.L('团队')}]]</span></a>
</li>
<li class="divider">[[${bundle.$L('审计')}]]</li>
<li class="divider">[[${bundle.L('审计')}]]</li>
<li th:class="${active == 'login-logs'} ? 'active'">
<a th:href="@{/admin/audit/login-logs}"><i class="icon zmdi zmdi-pin-account"></i><span>[[${bundle.$L('登录日志')}]]</span></a>
<a th:href="@{/admin/audit/login-logs}"><i class="icon zmdi zmdi-pin-account"></i><span>[[${bundle.L('登录日志')}]]</span></a>
</li>
<li th:class="${active == 'revision-history'} ? 'active'">
<a th:href="@{/admin/audit/revision-history}"><i class="icon zmdi zmdi-wrap-text"></i><span>[[${bundle.$L('变更历史')}]]</span></a>
<a th:href="@{/admin/audit/revision-history}"><i class="icon zmdi zmdi-wrap-text"></i><span>[[${bundle.L('变更历史')}]]</span></a>
</li>
<li th:class="${active == 'recycle-bin'} ? 'active'">
<a th:href="@{/admin/audit/recycle-bin}"><i class="icon zmdi zmdi-delete fs-16"></i><span>[[${bundle.$L('回收站')}]]</span></a>
<a th:href="@{/admin/audit/recycle-bin}"><i class="icon zmdi zmdi-delete fs-16"></i><span>[[${bundle.L('回收站')}]]</span></a>
</li>
</ul>
</div>

View file

@ -7,7 +7,7 @@
<div class="left-sidebar-content no-divider">
<ul class="sidebar-elements">
<li th:class="${active == 'dashboard-home'} ? 'active'">
<a th:href="@{/dashboard/home}"><i class="icon zmdi zmdi-home"></i><span>[[${bundle.$L('首页')}]]</span></a>
<a th:href="@{/dashboard/home}"><i class="icon zmdi zmdi-home"></i><span>[[${bundle.L('首页')}]]</span></a>
</li>
<th:block th:utext="${T(com.rebuild.core.configuration.NavBuilder).renderNav(#request, active)}"></th:block>
</ul>
@ -15,7 +15,7 @@
</div>
</div>
<div th:if="${AllowCustomNav}" class="bottom-widget">
<a class="nav-settings" th:title="${bundle.$L('导航菜单配置')}"><i class="icon zmdi zmdi-apps"></i></a>
<a class="nav-settings" th:title="${bundle.L('导航菜单配置')}"><i class="icon zmdi zmdi-apps"></i></a>
</div>
</div>
</div>

View file

@ -3,7 +3,7 @@
<div class="container-fluid">
<div class="rb-navbar-header">
<a class="navbar-brand" th:href="@{/dashboard/home}"></a>
<a class="rb-toggle-left-sidebar" th:title="${bundle.$L('展开/收缩')}"><span class="icon zmdi zmdi-menu"></span></a>
<a class="rb-toggle-left-sidebar" th:title="${bundle.L('展开/收缩')}"><span class="icon zmdi zmdi-menu"></span></a>
</div>
<!--
<div class="navbar-collapse collapse">
@ -13,7 +13,7 @@
</div>
-->
<div class="search-container">
<input class="form-control form-control-sm search-input-gs" type="text" name="search" maxlength="100" th:placeholder="${bundle.$L('搜索')}" autocomplete="off" />
<input class="form-control form-control-sm search-input-gs" type="text" name="search" maxlength="100" th:placeholder="${bundle.L('搜索')}" autocomplete="off" />
<div class="search-models animated fadeIn faster"></div>
</div>
<div class="rb-right-navbar">
@ -21,25 +21,25 @@
<li class="nav-item dropdown J_top-user">
<a class="nav-link dropdown-toggle" th:href="@{/settings/user}" data-toggle="dropdown">
<img th:src="|${baseUrl}/account/user-avatar?${session.davatarTime}|" alt="Avatar" />
<span class="user-name" th:text="${user.getFullName()}">[[${bundle.$L('姓名')}]]</span>
<span class="user-name" th:text="${user.getFullName()}">[[${bundle.L('姓名')}]]</span>
</a>
<div class="dropdown-menu">
<div class="user-info">
<div class="user-name" th:text="${user.getFullName()}">[[${bundle.$L('姓名')}]]</div>
<div class="user-id" th:data-user="${user.getId()}">[[${user.getEmail() ?: bundle.$L('邮箱未设置')}]]</div>
<div class="user-name" th:text="${user.getFullName()}">[[${bundle.L('姓名')}]]</div>
<div class="user-id" th:data-user="${user.getId()}">[[${user.getEmail() ?: bundle.L('邮箱未设置')}]]</div>
</div>
<a class="dropdown-item" th:href="@{/settings/user}"><i class="icon zmdi zmdi-account-box"></i>[[${bundle.$L('个人设置')}]]</a>
<a class="dropdown-item" th:href="@{/user/logout}"><i class="icon zmdi zmdi-power"></i>[[${bundle.$L('注销登录')}]]</a>
<a class="dropdown-item" th:href="@{/settings/user}"><i class="icon zmdi zmdi-account-box"></i>[[${bundle.L('个人设置')}]]</a>
<a class="dropdown-item" th:href="@{/user/logout}"><i class="icon zmdi zmdi-power"></i>[[${bundle.L('注销登录')}]]</a>
<div class="use-theme">
<div>[[${bundle.$L('选择主题')}]] <sup class="rbv"></sup></div>
<div>[[${bundle.L('选择主题')}]] <sup class="rbv"></sup></div>
<ul class="list-inline list-unstyled mt-1">
<li><a th:title="${bundle.$L('默认')}" class="theme-default" data-theme="default"></a></li>
<li><a th:title="${bundle.$L('深色')}" class="theme-dark" data-theme="dark"></a></li>
<li><a th:title="${bundle.$L('蓝色')}" class="theme-blue" data-theme="blue"></a></li>
<li><a th:title="${bundle.$L('红色')}" class="theme-red" data-theme="red"></a></li>
<li><a th:title="${bundle.$L('绿色')}" class="theme-green" data-theme="green"></a></li>
<li><a th:title="${bundle.$L('紫色')}" class="theme-purple" data-theme="purple"></a></li>
<li><a th:title="${bundle.$L('随机')}" class="theme-random" data-theme="_"></a></li>
<li><a th:title="${bundle.L('默认')}" class="theme-default" data-theme="default"></a></li>
<li><a th:title="${bundle.L('深色')}" class="theme-dark" data-theme="dark"></a></li>
<li><a th:title="${bundle.L('蓝色')}" class="theme-blue" data-theme="blue"></a></li>
<li><a th:title="${bundle.L('红色')}" class="theme-red" data-theme="red"></a></li>
<li><a th:title="${bundle.L('绿色')}" class="theme-green" data-theme="green"></a></li>
<li><a th:title="${bundle.L('紫色')}" class="theme-purple" data-theme="purple"></a></li>
<li><a th:title="${bundle.L('随机')}" class="theme-random" data-theme="_"></a></li>
</ul>
</div>
<div class="dev-show use-language">
@ -55,20 +55,20 @@
<li class="nav-item dropdown admin-danger hide">
<a class="nav-link" href="javascript:;"><i class="icon zmdi zmdi-alert-octagon text-danger"></i></a>
</li>
<li class="nav-item dropdown admin-show admin-settings" th:title="${bundle.$L('管理员后台')}">
<li class="nav-item dropdown admin-show admin-settings" th:title="${bundle.L('管理员后台')}">
<a class="nav-link" th:href="@{/admin/systems}"><i class="icon zmdi zmdi-settings"></i></a>
</li>
<li class="nav-item dropdown page-help" th:title="${bundle.$L('查看适用于本页的帮助')}">
<li class="nav-item dropdown page-help" th:title="${bundle.L('查看适用于本页的帮助')}">
<a class="nav-link" href="https://getrebuild.com/docs/" target="_blank"><i class="icon zmdi zmdi-help"></i></a>
</li>
<li class="nav-item dropdown J_top-notifications" th:title="${bundle.$L('通知')}">
<li class="nav-item dropdown J_top-notifications" th:title="${bundle.L('通知')}">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" th:href="@{/notifications}">
<i class="icon zmdi zmdi-notifications"></i>
<span class="indicator hide"></span>
</a>
<ul class="dropdown-menu rb-notifications">
<li>
<div class="title text-uppercase">[[${bundle.$L('未读')}]] <span class="badge badge-pill">0</span></div>
<div class="title text-uppercase">[[${bundle.L('未读')}]] <span class="badge badge-pill">0</span></div>
<div class="list">
<div class="rb-scroller">
<div class="content">
@ -76,7 +76,7 @@
</div>
</div>
</div>
<div class="footer"><a th:href="@{/notifications}">[[${bundle.$L('查看全部')}]]</a></div>
<div class="footer"><a th:href="@{/notifications}">[[${bundle.L('查看全部')}]]</a></div>
</li>
</ul>
</li>

View file

@ -2,11 +2,11 @@
<html xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:replace="~{/_include/header}" />
<title>[[${bundle.$L('管理员验证')}]]</title>
<title>[[${bundle.L('管理员验证')}]]</title>
<style type="text/css">
.rb-navbar-header .rb-toggle-left-sidebar,
.rb-icons-nav {
display: none !important;
display: none !important
}
</style>
</head>
@ -18,21 +18,21 @@
<div class="splash-container">
<div class="card card-border-color card-border-color-primary">
<div class="card-header">
<h4>[[${bundle.$L('需要验证你的管理员身份')}]]</h4>
<h4>[[${bundle.L('需要验证你的管理员身份')}]]</h4>
</div>
<div class="card-body">
<form>
<div class="form-group">
<input class="form-control" id="admin-passwd" type="password" th:placeholder="${bundle.$L('输入密码')}" autocomplete="off" />
<input class="form-control" id="admin-passwd" type="password" th:placeholder="${bundle.L('输入密码')}" autocomplete="off" />
</div>
<div class="form-group login-submit">
<button class="btn btn-primary btn-xl J_verify-btn" type="submit">[[${bundle.$L('确定')}]]</button>
<button class="btn btn-primary btn-xl J_verify-btn" type="submit">[[${bundle.L('确定')}]]</button>
</div>
</form>
</div>
</div>
<div class="splash-footer">
<span><a href="javascript:history.back()">[[${bundle.$L('返回')}]]</a></span>
<span><a href="javascript:history.back()">[[${bundle.L('返回')}]]</a></span>
</div>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show more