|
|
|
@ -6,10 +6,12 @@ import cn.estsh.i3plus.platform.common.tool.BeanCopyTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.SerializeTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleLanguage;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysLocaleResource;
|
|
|
|
@ -132,14 +134,9 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
@ApiOperation(value = "系统资源复杂查询,分页,排序",notes = "系统资源复杂查询,分页,排序")
|
|
|
|
|
public ListPager querySysLocaleResourceByPager(SysLocaleResource sysLocaleResource, Pager pager) {
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE SysLocaleResource:{},Pager:{}",sysLocaleResource,pager);
|
|
|
|
|
if(sysLocaleResourceRDao == null) {
|
|
|
|
|
pager = PagerHelper.getPager(pager, sysLocaleResourceRDao.listCount());
|
|
|
|
|
return new ListPager(sysLocaleResourceRDao.listPager(pager),pager);
|
|
|
|
|
}else {
|
|
|
|
|
String hqlPack = CoreHqlPack.packHqlSysLocaleResource(sysLocaleResource);
|
|
|
|
|
pager = PagerHelper.getPager(pager, sysLocaleResourceRDao.findByHqlWhereCount(hqlPack));
|
|
|
|
|
return new ListPager(sysLocaleResourceRDao.findByHqlWherePage(hqlPack + sysLocaleResource.orderBy(),pager),pager);
|
|
|
|
|
}
|
|
|
|
|
DdlPackBean packBean = CoreHqlPack.packHqlSysLocaleResource(sysLocaleResource);
|
|
|
|
|
pager = PagerHelper.getPager(pager, sysLocaleResourceRDao.findByHqlWhereCount(packBean));
|
|
|
|
|
return new ListPager(sysLocaleResourceRDao.findByHqlWherePage(packBean,pager),pager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -188,6 +185,11 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SysLocaleResource> findSysLocaleResource(SysLocaleResource sysLocaleResource) {
|
|
|
|
|
return sysLocaleResourceRDao.findByHqlWhere(CoreHqlPack.packHqlSysLocaleResource(sysLocaleResource));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public SysLocaleResource getSysLocaleResourceById(Long id) {
|
|
|
|
|
return sysLocaleResourceRDao.getById(id);
|
|
|
|
|
}
|
|
|
|
@ -196,63 +198,26 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
public List<SysMenu> tranSysMenu(List<SysMenu> menuList) {
|
|
|
|
|
if(menuList != null && menuList.size() > 0){
|
|
|
|
|
String languageCode = (String) AuthUtil.getSessionLanguage();
|
|
|
|
|
List<SysLocaleLanguage> languageList = sysLocaleLanguageRDao.list();
|
|
|
|
|
menuList = (List<SysMenu>) SerializeTool.copyObject(menuList);
|
|
|
|
|
Map<String,String> resourceMap = new HashMap<>();
|
|
|
|
|
List<SysLocaleResource> insertList = new ArrayList<>();
|
|
|
|
|
SysLocaleResource insert = null;
|
|
|
|
|
String redisMenuKey = null;
|
|
|
|
|
String redisMenuParentKey = null;
|
|
|
|
|
|
|
|
|
|
String redisLanguageKey = CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE_MENU + ":" + languageCode;
|
|
|
|
|
Map menuResourceMap = redisRes.getHashMap(redisLanguageKey);
|
|
|
|
|
|
|
|
|
|
if(menuResourceMap != null && menuResourceMap.size() > 0 ){
|
|
|
|
|
for (SysMenu menu : menuList) {
|
|
|
|
|
if(menu != null){
|
|
|
|
|
redisMenuKey = CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE +":" + menu.getName();
|
|
|
|
|
redisMenuParentKey = CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE +":" + menu.getParentId();
|
|
|
|
|
Map menuResourceMap = redisRes.getHashMap(redisMenuKey);
|
|
|
|
|
Map menuParentSesourceMap = redisRes.getHashMap(redisMenuParentKey);
|
|
|
|
|
|
|
|
|
|
if(menuResourceMap == null || menuResourceMap.size() <= 0){
|
|
|
|
|
menuResourceMap = new HashMap();
|
|
|
|
|
if(languageList != null){
|
|
|
|
|
for (SysLocaleLanguage language : languageList) {
|
|
|
|
|
insert = new SysLocaleResource();
|
|
|
|
|
insert.setResourceType(CommonEnumUtil.SYS_LOCALE_RESOURCE_TYPE.MENU.getValue());
|
|
|
|
|
insert.setLanguageCode(language.getLanguageCode());
|
|
|
|
|
insert.setLanguageNameRdd(language.getLanguageName());
|
|
|
|
|
insert.setResourceKey(menu.getName());
|
|
|
|
|
insert.setResourceValue(menu.getName());
|
|
|
|
|
insert.setIsSystem(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue());
|
|
|
|
|
ConvertBean.serviceModelInitialize(insert, PlatformConstWords.SYSTEM_INIT_USER);
|
|
|
|
|
|
|
|
|
|
insertList.add(insert);
|
|
|
|
|
menuResourceMap.put(language.getLanguageCode(),insert.getResourceValue());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 保存 Redis */
|
|
|
|
|
if(redisMenuKey.equals("CACHE_LANGUAGE:用户管理")){
|
|
|
|
|
System.out.println("===./");
|
|
|
|
|
}
|
|
|
|
|
redisRes.putHashMap(redisMenuKey, menuResourceMap, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 菜单名称 国际化 */
|
|
|
|
|
if(menuResourceMap != null && menuResourceMap.size() > 0){
|
|
|
|
|
String menuName = (String)menuResourceMap.get(languageCode);
|
|
|
|
|
if(StringUtils.isNotBlank(menu.getName())){
|
|
|
|
|
String menuName = (String)menuResourceMap.get(menu.getName());
|
|
|
|
|
menu.setName(StringUtils.isNotBlank(menuName) ? menuName : menu.getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 功能菜单 父节点国际化 */
|
|
|
|
|
if(menuParentSesourceMap != null && menuParentSesourceMap.size() > 0){
|
|
|
|
|
String parentNameRdd = (String)menuParentSesourceMap.get(languageCode);
|
|
|
|
|
if(StringUtils.isNotBlank(menu.getParentNameRdd())){
|
|
|
|
|
String parentNameRdd = (String)menuResourceMap.get(menu.getParentNameRdd());
|
|
|
|
|
menu.setParentNameRdd(StringUtils.isNotBlank(parentNameRdd) ? parentNameRdd : menu.getParentNameRdd());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 保存资源信息 */
|
|
|
|
|
if(insertList != null && insertList.size() > 0){
|
|
|
|
|
sysLocaleResourceRDao.saveAll(insertList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return menuList;
|
|
|
|
|