|
|
|
@ -31,6 +31,8 @@ import javax.annotation.Resource;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import static cn.estsh.i3plus.platform.common.util.CommonConstWords.RESOURCE_PREFIX_MENU;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 系统资源
|
|
|
|
|
* @Reference :
|
|
|
|
@ -48,17 +50,17 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysLocaleLanguageRepository sysLocaleLanguageRDao;
|
|
|
|
|
|
|
|
|
|
@Resource(name= CommonConstWords.IMPP_REDIS_RES)
|
|
|
|
|
@Resource(name = CommonConstWords.IMPP_REDIS_RES)
|
|
|
|
|
private ImppRedis redisRes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "新增系统资源")
|
|
|
|
|
public SysLocaleResource insertSysLocaleResource(SysLocaleResource sysLocaleResource) {
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE SysLocaleResource:{}",sysLocaleResource);
|
|
|
|
|
int count = sysLocaleResourceRDao.findByPropertyCount(new String[]{"languageCode","resourceKey"},
|
|
|
|
|
new String[]{sysLocaleResource.getLanguageCode(),sysLocaleResource.getResourceKey()});
|
|
|
|
|
if (count > 0){
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE SysLocaleResource:{}", sysLocaleResource);
|
|
|
|
|
int count = sysLocaleResourceRDao.findByPropertyCount(new String[]{"languageCode", "resourceKey"},
|
|
|
|
|
new String[]{sysLocaleResource.getLanguageCode(), sysLocaleResource.getResourceKey()});
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
@ -69,8 +71,8 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
|
|
|
|
|
// 设置语言名称冗余
|
|
|
|
|
SysLocaleLanguage sysLocaleLanguage = sysLocaleLanguageRDao.getByProperty("languageCode",
|
|
|
|
|
sysLocaleResource.getLanguageCode());
|
|
|
|
|
ValidatorBean.checkNotNull(sysLocaleLanguage,"选中的语言不存在");
|
|
|
|
|
sysLocaleResource.getLanguageCode());
|
|
|
|
|
ValidatorBean.checkNotNull(sysLocaleLanguage, "选中的语言不存在");
|
|
|
|
|
sysLocaleResource.setLanguageNameRdd(sysLocaleLanguage.getLanguageName());
|
|
|
|
|
|
|
|
|
|
return sysLocaleResourceRDao.insert(sysLocaleResource);
|
|
|
|
@ -79,7 +81,7 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SysLocaleResource> saveSysLocaleResource(List<SysLocaleResource> list) {
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE list:{}",list);
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE list:{}", list);
|
|
|
|
|
for (SysLocaleResource sysLocaleResource : list) {
|
|
|
|
|
sysLocaleResourceRDao.insert(sysLocaleResource);
|
|
|
|
|
}
|
|
|
|
@ -87,7 +89,7 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "修改系统资源",notes = "修改系统资源")
|
|
|
|
|
@ApiOperation(value = "修改系统资源", notes = "修改系统资源")
|
|
|
|
|
public void updateSysLocaleResource(SysLocaleResource sysLocaleResource) {
|
|
|
|
|
SysLocaleResource originSysLocaleResource = sysLocaleResourceRDao.getById(sysLocaleResource.getId());
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE SysLocaleResource:{}", sysLocaleResource);
|
|
|
|
@ -114,32 +116,32 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据id删除系统资源",notes = "根据id删除系统资源")
|
|
|
|
|
@ApiOperation(value = "根据id删除系统资源", notes = "根据id删除系统资源")
|
|
|
|
|
public void deleteSysLocaleResourceById(Long id) {
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE id:{}",id);
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE id:{}", id);
|
|
|
|
|
sysLocaleResourceRDao.deleteById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "查询全部系统资源",notes = "查询全部系统资源")
|
|
|
|
|
@ApiOperation(value = "查询全部系统资源", notes = "查询全部系统资源")
|
|
|
|
|
public List listSysLocaleResource() {
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE list");
|
|
|
|
|
return sysLocaleResourceRDao.list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "系统资源复杂查询,分页,排序",notes = "系统资源复杂查询,分页,排序")
|
|
|
|
|
@ApiOperation(value = "系统资源复杂查询,分页,排序", notes = "系统资源复杂查询,分页,排序")
|
|
|
|
|
public ListPager querySysLocaleResourceByPager(SysLocaleResource sysLocaleResource, Pager pager) {
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE SysLocaleResource:{},Pager:{}",sysLocaleResource,pager);
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE SysLocaleResource:{},Pager:{}", sysLocaleResource, pager);
|
|
|
|
|
DdlPackBean packBean = CoreHqlPack.packHqlSysLocaleResource(sysLocaleResource);
|
|
|
|
|
pager = PagerHelper.getPager(pager, sysLocaleResourceRDao.findByHqlWhereCount(packBean));
|
|
|
|
|
return new ListPager(sysLocaleResourceRDao.findByHqlWherePage(packBean,pager),pager);
|
|
|
|
|
return new ListPager(sysLocaleResourceRDao.findByHqlWherePage(packBean, pager), pager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据id批量删除",notes = "根据id批量删除")
|
|
|
|
|
@ApiOperation(value = "根据id批量删除", notes = "根据id批量删除")
|
|
|
|
|
public void deleteSysLocaleResourceByIds(Long[] ids) {
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE ids:{}",ids);
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE ids:{}", ids);
|
|
|
|
|
sysLocaleResourceRDao.deleteByIds(ids);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -148,10 +150,10 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
public void insertSysLocaleResourceList(List<SysLocaleResource> sysLocaleResourcesList) {
|
|
|
|
|
// 添加校验
|
|
|
|
|
SysLocaleResource sysLocaleResource = sysLocaleResourcesList.get(0);
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE SysLocaleResource:{}",sysLocaleResource);
|
|
|
|
|
int count = sysLocaleResourceRDao.findByPropertyCount(new String[]{"languageCode","resourceKey"},
|
|
|
|
|
new String[]{sysLocaleResource.getLanguageCode(),sysLocaleResource.getResourceKey()});
|
|
|
|
|
if (count > 0){
|
|
|
|
|
LOGGER.info("系统资源 SYS_LOCALE_RESOURCE SysLocaleResource:{}", sysLocaleResource);
|
|
|
|
|
int count = sysLocaleResourceRDao.findByPropertyCount(new String[]{"languageCode", "resourceKey"},
|
|
|
|
|
new String[]{sysLocaleResource.getLanguageCode(), sysLocaleResource.getResourceKey()});
|
|
|
|
|
if (count > 0) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
@ -163,7 +165,7 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
// 设置语言名称冗余
|
|
|
|
|
SysLocaleLanguage sysLocaleLanguage = sysLocaleLanguageRDao.getByProperty("languageCode",
|
|
|
|
|
sysLocaleResource.getLanguageCode());
|
|
|
|
|
ValidatorBean.checkNotNull(sysLocaleLanguage,"选中的语言不存在");
|
|
|
|
|
ValidatorBean.checkNotNull(sysLocaleLanguage, "选中的语言不存在");
|
|
|
|
|
sysLocaleResource.setLanguageNameRdd(sysLocaleLanguage.getLanguageName());
|
|
|
|
|
|
|
|
|
|
sysLocaleResourceRDao.saveAll(sysLocaleResourcesList);
|
|
|
|
@ -171,14 +173,14 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "根据语言code和资源key查询资源")
|
|
|
|
|
public SysLocaleResource getSysLocaleResourceByLanguageCodeAndResKey(String languageCode,String resKey) {
|
|
|
|
|
return sysLocaleResourceRDao.getByProperty(new String[]{"languageCode","resourceKey"},new String[]{languageCode,resKey});
|
|
|
|
|
public SysLocaleResource getSysLocaleResourceByLanguageCodeAndResKey(String languageCode, String resKey) {
|
|
|
|
|
return sysLocaleResourceRDao.getByProperty(new String[]{"languageCode", "resourceKey"}, new String[]{languageCode, resKey});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SysLocaleResource> findSysLocaleResourceByResKey(String resKey) {
|
|
|
|
|
return sysLocaleResourceRDao.findByProperty(new String[]{"resourceKey"},new String[]{resKey});
|
|
|
|
|
return sysLocaleResourceRDao.findByProperty(new String[]{"resourceKey"}, new String[]{resKey});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -193,23 +195,23 @@ public class SysLocaleResourceService implements ISysLocaleResourceService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SysMenu> tranSysMenu(List<SysMenu> menuList) {
|
|
|
|
|
if(menuList != null && menuList.size() > 0){
|
|
|
|
|
if (menuList != null && menuList.size() > 0) {
|
|
|
|
|
String languageCode = (String) AuthUtil.getSessionLanguage();
|
|
|
|
|
menuList = (List<SysMenu>) SerializeTool.copyObject(menuList);
|
|
|
|
|
|
|
|
|
|
String redisLanguageKey = CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE_MENU + ":" + languageCode;
|
|
|
|
|
Map menuResourceMap = redisRes.getHashMap(redisLanguageKey);
|
|
|
|
|
|
|
|
|
|
if(menuResourceMap != null && menuResourceMap.size() > 0 ){
|
|
|
|
|
if (menuResourceMap != null && menuResourceMap.size() > 0) {
|
|
|
|
|
for (SysMenu menu : menuList) {
|
|
|
|
|
if(menu != null){
|
|
|
|
|
if(StringUtils.isNotBlank(menu.getName())){
|
|
|
|
|
String menuName = (String)menuResourceMap.get(menu.getName());
|
|
|
|
|
if (menu != null) {
|
|
|
|
|
if (StringUtils.isNotBlank(menu.getName())) {
|
|
|
|
|
String menuName = (String) menuResourceMap.get(RESOURCE_PREFIX_MENU + menu.getName());
|
|
|
|
|
menu.setName(StringUtils.isNotBlank(menuName) ? menuName : menu.getName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(menu.getParentNameRdd())){
|
|
|
|
|
String parentNameRdd = (String)menuResourceMap.get(menu.getParentNameRdd());
|
|
|
|
|
if (StringUtils.isNotBlank(menu.getParentNameRdd())) {
|
|
|
|
|
String parentNameRdd = (String) menuResourceMap.get(RESOURCE_PREFIX_MENU + menu.getParentNameRdd());
|
|
|
|
|
menu.setParentNameRdd(StringUtils.isNotBlank(parentNameRdd) ? parentNameRdd : menu.getParentNameRdd());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|