|
|
|
@ -72,21 +72,25 @@ public class SystemInitService implements ISystemInitService {
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "加载字典数据",notes = "加载字典数据")
|
|
|
|
|
public void loadSysDictionary() {
|
|
|
|
|
List<SysDictionary> list = dictionaryRDao.findAll();
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
Map<String, List<SysDictionary>> parentCodeMap = list.stream().collect(Collectors.groupingBy(SysDictionary::getParentCodeRdd));
|
|
|
|
|
Map<Long, List<SysDictionary>> parentIdMap = list.stream().collect(Collectors.groupingBy(SysDictionary::getParentId));
|
|
|
|
|
|
|
|
|
|
for (String key : parentCodeMap.keySet()) {
|
|
|
|
|
//存放于缓存
|
|
|
|
|
putDataToCache(CommonConstWords.REDIS_PREFIX_CACHE_DICTIONARY + "_" + key,
|
|
|
|
|
parentCodeMap.get(key),List.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (long key : parentIdMap.keySet()) {
|
|
|
|
|
putDataToCache(CommonConstWords.REDIS_PREFIX_CACHE_DICTIONARY + "_" + key,
|
|
|
|
|
parentIdMap.get(key),List.class);
|
|
|
|
|
try {
|
|
|
|
|
List<SysDictionary> list = dictionaryRDao.findAll();
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
Map<String, List<SysDictionary>> parentCodeMap = list.stream().collect(Collectors.groupingBy(SysDictionary::getParentCodeRdd));
|
|
|
|
|
Map<Long, List<SysDictionary>> parentIdMap = list.stream().collect(Collectors.groupingBy(SysDictionary::getParentId));
|
|
|
|
|
|
|
|
|
|
for (String key : parentCodeMap.keySet()) {
|
|
|
|
|
//存放于缓存
|
|
|
|
|
putDataToCache(CommonConstWords.REDIS_PREFIX_CACHE_DICTIONARY + "_" + key,
|
|
|
|
|
parentCodeMap.get(key),List.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (long key : parentIdMap.keySet()) {
|
|
|
|
|
putDataToCache(CommonConstWords.REDIS_PREFIX_CACHE_DICTIONARY + "_" + key,
|
|
|
|
|
parentIdMap.get(key),List.class);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|