add:菜单国际化
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
2024-12-21 08:26:11.869 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
|
||||
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'passRCL' defined in file [D:\workspace\hengseng\wms1.0\wms_pro\hd\nladmin-system\target\classes\org\nl\wms\decision_manage\handler\decisioner\impl\diy\PassRCLHandler.class]: Invocation of init method failed; nested exception is org.nl.common.domain.exception.BadRequestException: 启动失败:当前策略passRCL没有实例信息
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
|
||||
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
|
||||
at org.nl.AppRun.main(AppRun.java:39)
|
||||
Caused by: org.nl.common.domain.exception.BadRequestException: 启动失败:当前策略passRCL没有实例信息
|
||||
at org.nl.wms.decision_manage.handler.decisioner.Decisioner.afterPropertiesSet(Decisioner.java:36)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
|
||||
... 16 common frames omitted
|
||||
2024-12-21 08:37:26.771 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
|
||||
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'passRCL' defined in file [D:\workspace\hengseng\wms1.0\wms_pro\hd\nladmin-system\target\classes\org\nl\wms\decision_manage\handler\decisioner\impl\diy\PassRCLHandler.class]: Invocation of init method failed; nested exception is org.nl.common.domain.exception.BadRequestException: 启动失败:当前策略passRCL没有实例信息
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1804)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
|
||||
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
|
||||
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
|
||||
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953)
|
||||
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
|
||||
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
|
||||
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
|
||||
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
|
||||
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
|
||||
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
|
||||
at org.nl.AppRun.main(AppRun.java:39)
|
||||
Caused by: org.nl.common.domain.exception.BadRequestException: 启动失败:当前策略passRCL没有实例信息
|
||||
at org.nl.wms.decision_manage.handler.decisioner.Decisioner.afterPropertiesSet(Decisioner.java:36)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
|
||||
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
|
||||
... 16 common frames omitted
|
||||
@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import org.nl.common.domain.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.base_manage.material.service.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.base_manage.material.service.dao.MdMeMaterialbase;
|
||||
@@ -46,6 +47,7 @@ public class BmMaterialController {
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody MdMeMaterialbase dto) {
|
||||
dto.setMaterial_id(IdUtil.getStringId());
|
||||
materialService.save(dto);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.entity.PageQuery;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
@@ -43,7 +44,7 @@ public class BmSupplierController {
|
||||
|
||||
@PostMapping
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody BmSupplier dto) {
|
||||
dto.setSupp_id(IdUtil.getLongId());
|
||||
dto.setSupp_id(IdUtil.getStringId());
|
||||
dto.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
dto.setCreate_time(DateUtil.now());
|
||||
@@ -53,6 +54,7 @@ public class BmSupplierController {
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Log("修改供应商")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody BmSupplier dto) {
|
||||
dto.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
@@ -63,9 +65,12 @@ public class BmSupplierController {
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
if (ids.length > 0) {
|
||||
supplierService.removeByIds(Arrays.asList(ids));
|
||||
for (Long id : ids) {
|
||||
supplierService.removeById(id);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ public class BmSupplier implements Serializable {
|
||||
/**
|
||||
* 供应商标识
|
||||
*/
|
||||
@TableId
|
||||
private Long supp_id;
|
||||
@TableId("supp_id")
|
||||
private String supp_id;
|
||||
|
||||
/**
|
||||
* 供应商编码
|
||||
|
||||
@@ -61,6 +61,19 @@ public class SysMenu implements Serializable {
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 菜单标题
|
||||
*/
|
||||
private String zh_title;
|
||||
/**
|
||||
* 菜单标题
|
||||
*/
|
||||
private String en_title;
|
||||
/**
|
||||
* 菜单标题
|
||||
*/
|
||||
private String es_title;
|
||||
|
||||
/**
|
||||
* 组件名称
|
||||
*/
|
||||
|
||||
@@ -40,6 +40,10 @@ public class MenuDto implements Serializable {
|
||||
|
||||
private String title;
|
||||
|
||||
private String zh_title;
|
||||
private String en_title;
|
||||
private String es_title;
|
||||
|
||||
private Integer menu_sort;
|
||||
|
||||
private String path;
|
||||
@@ -106,4 +110,17 @@ public class MenuDto implements Serializable {
|
||||
public int hashCode() {
|
||||
return Objects.hash(menu_id);
|
||||
}
|
||||
|
||||
public String getLocalTitle(String local){
|
||||
if ("es".equals(local)){
|
||||
return es_title;
|
||||
}
|
||||
if ("en".equals(local)){
|
||||
return en_title;
|
||||
}
|
||||
if ("zh".equals(local)){
|
||||
return zh_title;
|
||||
}
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.nl.wms.system_manage.service.menu.dto.MenuDto;
|
||||
import org.nl.wms.system_manage.service.menu.dto.MenuMetaVo;
|
||||
import org.nl.wms.system_manage.service.menu.dto.MenuQuery;
|
||||
import org.nl.wms.system_manage.service.menu.dto.MenuVo;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
@@ -265,11 +266,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
@Override
|
||||
public List<MenuVo> buildMenus(List<MenuDto> menuDtos) {
|
||||
List<MenuVo> list = new LinkedList<>();
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
menuDtos.forEach(menuDTO -> {
|
||||
if (menuDTO != null) {
|
||||
List<MenuDto> menuDtoList = menuDTO.getChildren();
|
||||
MenuVo menuVo = new MenuVo();
|
||||
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getTitle());
|
||||
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
|
||||
// 一级目录需要加斜杠,不然会报警告
|
||||
menuVo.setPath(ObjectUtil.isEmpty(menuDTO.getPid()) ? "/" + menuDTO.getPath() : menuDTO.getPath());
|
||||
menuVo.setHidden(menuDTO.getHidden());
|
||||
@@ -284,7 +286,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
menuVo.setComponent(menuDTO.getComponent());
|
||||
}
|
||||
}
|
||||
menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(), menuDTO.getIcon(), !menuDTO.getCache()));
|
||||
menuVo.setMeta(new MenuMetaVo(menuDTO.getLocalTitle(lang), menuDTO.getIcon(), !menuDTO.getCache()));
|
||||
if (menuDtoList != null && menuDtoList.size() != 0) {
|
||||
menuVo.setAlwaysShow(true);
|
||||
menuVo.setRedirect("noredirect");
|
||||
@@ -351,9 +353,22 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
queryWrapper = new QueryWrapper<SysMenu>().isNull("pid");
|
||||
}
|
||||
queryWrapper.orderByAsc("menu_sort");
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
List<SysMenu> sysMenus = baseMapper.selectList(queryWrapper);
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
for (SysMenu sysMenu : sysMenus) {
|
||||
sysMenu.setTitle(getLocal(lang, sysMenu));
|
||||
}
|
||||
return sysMenus;
|
||||
}
|
||||
|
||||
private String getLocal(String lang,SysMenu sysMenu){
|
||||
if ("es".equals(lang)){
|
||||
return sysMenu.getEs_title();
|
||||
}
|
||||
if ("en".equals(lang)){
|
||||
return sysMenu.getEn_title();
|
||||
}
|
||||
return sysMenu.getTitle();
|
||||
};
|
||||
@Override
|
||||
public MenuDto doToDto(SysMenu entity) {
|
||||
|
||||
@@ -365,6 +380,9 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
menuDto.setType(entity.getType());
|
||||
menuDto.setPermission(entity.getPermission());
|
||||
menuDto.setTitle(entity.getTitle());
|
||||
menuDto.setEs_title(entity.getEs_title());
|
||||
menuDto.setEn_title(entity.getEn_title());
|
||||
menuDto.setZh_title(entity.getZh_title());
|
||||
menuDto.setMenu_sort(entity.getMenu_sort());
|
||||
menuDto.setPath(entity.getPath());
|
||||
menuDto.setComponent(entity.getComponent());
|
||||
@@ -408,11 +426,12 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
public List<MenuVo> buildMenus(List<MenuDto> menuDtos, String pid) {
|
||||
List<MenuVo> list = new LinkedList<>();
|
||||
//剔除系统级菜单
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
menuDtos.forEach(menuDTO -> {
|
||||
if (menuDTO != null) {
|
||||
List<MenuDto> menuDtoList = menuDTO.getChildren();
|
||||
MenuVo menuVo = new MenuVo();
|
||||
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getTitle());
|
||||
menuVo.setName(ObjectUtil.isNotEmpty(menuDTO.getComponent_name()) ? menuDTO.getComponent_name() : menuDTO.getLocalTitle(lang));
|
||||
// 一级目录需要加斜杠,不然会报警告
|
||||
menuVo.setPath(pid.equals(menuDTO.getPid())? "/" + menuDTO.getPath() : menuDTO.getPath());
|
||||
menuVo.setHidden(menuDTO.getHidden());
|
||||
@@ -420,15 +439,14 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
if (!menuDTO.getIframe()) {
|
||||
if (pid.equals(menuDTO.getPid())) {
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "Layout" : menuDTO.getComponent());
|
||||
//"2".equals(menuDTO.getType() 判断是不是目录
|
||||
} else if (!pid.equals(menuDTO.getPid()) && "2".equals(menuDTO.getType())) {
|
||||
} else if (!pid.equals(menuDTO.getPid()) && "0".equals(menuDTO.getType())) {
|
||||
menuVo.setComponent(StrUtil.isEmpty(menuDTO.getComponent()) ? "ParentView" : menuDTO.getComponent());
|
||||
|
||||
} else if (!StrUtil.isEmpty(menuDTO.getComponent())) {
|
||||
menuVo.setComponent(menuDTO.getComponent());
|
||||
}
|
||||
}
|
||||
menuVo.setMeta(new MenuMetaVo(menuDTO.getTitle(), menuDTO.getIcon(), !menuDTO.getCache()));
|
||||
menuVo.setMeta(new MenuMetaVo(menuDTO.getLocalTitle(lang), menuDTO.getIcon(), !menuDTO.getCache()));
|
||||
if (menuDtoList != null && menuDtoList.size() != 0) {
|
||||
menuVo.setAlwaysShow(true);
|
||||
menuVo.setRedirect("noredirect");
|
||||
|
||||
Reference in New Issue
Block a user