6 changed files with 179 additions and 34 deletions
-
32src/main/java/com/xujie/sys/common/exception/I18nException.java
-
44src/main/java/com/xujie/sys/common/exception/XJExceptionHandler.java
-
19src/main/java/com/xujie/sys/config/I18nConfig.java
-
55src/main/java/com/xujie/sys/modules/longchuang/service/impl/ProductionPlanServiceImpl.java
-
31src/main/resources/i18n/messages_en_US.properties
-
32src/main/resources/i18n/messages_zh_CN.properties
@ -0,0 +1,32 @@ |
|||
package com.xujie.sys.common.exception; |
|||
|
|||
public class I18nException extends RuntimeException { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
private final String messageKey; |
|||
private final transient Object[] args; |
|||
private final int code; |
|||
|
|||
public I18nException(String messageKey, Object... args) { |
|||
this(messageKey, 500, args); |
|||
} |
|||
|
|||
public I18nException(String messageKey, int code, Object... args) { |
|||
super(messageKey); |
|||
this.messageKey = messageKey; |
|||
this.code = code; |
|||
this.args = args == null ? new Object[0] : args; |
|||
} |
|||
|
|||
public String getMessageKey() { |
|||
return messageKey; |
|||
} |
|||
|
|||
public Object[] getArgs() { |
|||
return args; |
|||
} |
|||
|
|||
public int getCode() { |
|||
return code; |
|||
} |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.xujie.sys.config; |
|||
|
|||
import org.springframework.context.MessageSource; |
|||
import org.springframework.context.annotation.Bean; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.context.support.ReloadableResourceBundleMessageSource; |
|||
|
|||
@Configuration |
|||
public class I18nConfig { |
|||
|
|||
@Bean |
|||
public MessageSource messageSource() { |
|||
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); |
|||
messageSource.setBasenames("classpath:i18n/messages"); |
|||
messageSource.setDefaultEncoding("UTF-8"); |
|||
messageSource.setUseCodeAsDefaultMessage(true); |
|||
return messageSource; |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
common.unknown.error=Unknown exception. Please contact administrator. |
|||
common.path.not.found=Path not found. Please check the request path. |
|||
common.duplicate.record=The record already exists in database. |
|||
common.no.permission=No permission. Please contact administrator for authorization. |
|||
|
|||
lc.production.node.role.assign.param.incomplete=Node role configuration parameters are incomplete. |
|||
lc.production.node.assignee.assign.param.incomplete=Node assignee assignment parameters are incomplete. |
|||
lc.production.order.not.exists.cannot.assign=Order does not exist, cannot assign node assignees. |
|||
lc.production.node.role.type.undefined=Node role type is undefined: {0} |
|||
lc.production.user.role.type.not.configured=User has no matching role type configured, node: {0}, role type: {1} |
|||
lc.production.order.not.exists.cannot.save=Order does not exist, cannot save. |
|||
lc.production.save.param.empty=Save parameters cannot be empty. |
|||
lc.production.task.no.required=Task number cannot be empty. |
|||
lc.production.task.type.required=Task type cannot be empty. |
|||
lc.production.project.no.required=Project number cannot be empty. |
|||
lc.production.model.required=Model cannot be empty. |
|||
lc.production.report.param.incomplete=Report parameters are incomplete. |
|||
lc.production.order.not.exists.or.deleted=Order does not exist or has been deleted. |
|||
lc.production.order.done.cannot.report=Order is completed and cannot be reported again. |
|||
lc.production.report.node.not.exists=Reporting node does not exist. |
|||
lc.production.report.sequential.need.first.node=This order must be reported sequentially. Please complete node first: {0} |
|||
lc.production.node.already.done=Node is already completed. No duplicate report is needed. |
|||
lc.production.report.qty.gt.zero=Report quantity must be greater than 0. |
|||
lc.production.node.assignee.not.assigned=Current node has no assignee. Please assign node personnel first. |
|||
lc.production.node.assignee.current.user.invalid=Current user is not the assignee of this node and cannot report. |
|||
lc.production.node.role.type.undefined.for.report=Node role type is undefined and cannot be reported. |
|||
lc.production.node.role.no.permission=Current user does not have report permission for this role type: {0} |
|||
lc.production.finish.param.empty=Finish parameters cannot be empty. |
|||
lc.production.delete.param.empty=Delete parameters cannot be empty. |
|||
lc.production.delete.failed.order.not.exists=Delete failed. Order does not exist. |
|||
lc.production.current.user.not.found=Logged-in user is not available. |
|||
@ -0,0 +1,32 @@ |
|||
common.unknown.error=未知异常,请联系管理员 |
|||
common.path.not.found=路径不存在,请检查路径是否正确 |
|||
common.duplicate.record=数据库已存在该记录 |
|||
common.no.permission=没有权限,请联系管理员授权 |
|||
|
|||
lc.production.node.role.assign.param.incomplete=节点角色配置参数不完整 |
|||
lc.production.node.assignee.assign.param.incomplete=节点负责人分配参数不完整 |
|||
lc.production.order.not.exists.cannot.assign=订单不存在,不能分配节点负责人 |
|||
lc.production.node.role.type.undefined=节点角色类型未定义: {0} |
|||
lc.production.user.role.type.not.configured=用户未配置对应角色类型,节点: {0},角色类型: {1} |
|||
lc.production.order.not.exists.cannot.save=订单不存在,无法保存 |
|||
lc.production.save.param.empty=保存参数不能为空 |
|||
lc.production.task.no.required=任务单号不能为空 |
|||
lc.production.task.type.required=任务类型不能为空 |
|||
lc.production.project.no.required=项目号不能为空 |
|||
lc.production.model.required=型号不能为空 |
|||
lc.production.report.param.incomplete=报工参数不完整 |
|||
lc.production.order.not.exists.or.deleted=订单不存在或已删除 |
|||
lc.production.order.done.cannot.report=订单已完成,不能继续报工 |
|||
lc.production.report.node.not.exists=报工节点不存在 |
|||
lc.production.report.sequential.need.first.node=当前订单按顺序报工,请先完成节点: {0} |
|||
lc.production.node.already.done=节点已完成,无需重复报工 |
|||
lc.production.report.qty.gt.zero=报工数量必须大于0 |
|||
lc.production.node.assignee.not.assigned=当前节点未分配负责人,请先完成节点人员分配 |
|||
lc.production.node.assignee.current.user.invalid=当前用户不是该节点负责人,不能报工 |
|||
lc.production.node.role.type.undefined.for.report=未定义节点角色类型,无法报工 |
|||
lc.production.node.role.no.permission=当前用户不具备该节点报工角色权限,角色类型: {0} |
|||
lc.production.finish.param.empty=完工参数不能为空 |
|||
lc.production.delete.param.empty=删除参数不能为空 |
|||
lc.production.delete.failed.order.not.exists=删除失败,订单不存在 |
|||
lc.production.current.user.not.found=未获取到登录用户 |
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue