添加字典分组

优化redis资源键
yun-zuoyi
汪云昊 6 years ago
parent 7b7439fda5
commit e2a2dd18d8

@ -135,4 +135,12 @@ public interface ISysDictionaryService {
*/
@ApiOperation(value = "根据parenId查询字典")
List<SysDictionary> findSysDictionaryByParentId(Long parentId);
/**
*
* @param sysDictionary
* @return
*/
@ApiOperation(value = "按条件查询字典")
List<SysDictionary> findSysDictionary(SysDictionary sysDictionary);
}

@ -457,4 +457,22 @@ public class SysDictionaryController extends CoreBaseController{
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
/**
*
* @param sysDictionary
* @return
*/
@GetMapping("/find")
@ApiOperation(value = "按条件查询字典",notes = "按条件查询字典")
public ResultBean<SysDictionary> findSysDictionary(@RequestBody SysDictionary sysDictionary){
try {
List<SysDictionary> dictionaryList = sysDictionaryService.findSysDictionary(sysDictionary);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(dictionaryList);
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -286,6 +286,7 @@ public class SysEnumController extends CoreBaseController {
}
/**
*
* @return
*/
@GetMapping("/external-notice-method")
@ -296,5 +297,16 @@ public class SysEnumController extends CoreBaseController {
return new ResultBean(true, "操作成功", list);
}
/**
*
* @return
*/
@GetMapping("/dictionary-group")
@ApiOperation(value = "字典分组", notes = "字典分组")
public ResultBean getDictionaryGroup() {
return new ResultBean(true, "操作成功",
Arrays.asList(ImppEnumUtil.DICTIONARY_GROUP.values()));
}
}

@ -126,7 +126,7 @@ public class SysLocaleLanguageController extends CoreBaseController {
sysLocaleLanguageService.deleteSysLocaleLanguageById(Long.parseLong(idStr));
// 移出缓存
redisCore.deleteKey(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + sysLocaleLanguage.getLanguageCode());
redisCore.deleteKey(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + sysLocaleLanguage.getLanguageCode());
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);

@ -246,23 +246,23 @@ public class SysLocaleResourceController extends CoreBaseController {
private void updateResourceCache(SysLocaleResource sysLocaleResource,boolean isDelete){
// 判断是否为删除资源
if(isDelete){
Map<Object, Object> langMap = redisRes.getHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + sysLocaleResource.getLanguageCode());
Map<Object, Object> langMap = redisRes.getHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + sysLocaleResource.getLanguageCode());
if (langMap != null && langMap.size() != 0) {
langMap.remove(sysLocaleResource.getResourceKey());
redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + sysLocaleResource.getLanguageCode(), langMap);
redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + sysLocaleResource.getLanguageCode(), langMap);
}
redisRes.deleteKey(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + sysLocaleResource.getResourceKey());
redisRes.deleteKey(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + sysLocaleResource.getResourceKey());
}else {
Map<Object, Object> langMap = redisRes.getHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + sysLocaleResource.getLanguageCode());
Map<Object, Object> langMap = redisRes.getHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + sysLocaleResource.getLanguageCode());
if (langMap != null && langMap.size() != 0) {
langMap.put(sysLocaleResource.getResourceKey(), sysLocaleResource.getResourceValue());
redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + sysLocaleResource.getLanguageCode(), langMap);
redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + sysLocaleResource.getLanguageCode(), langMap);
}
HashMap<String, String> resource = new HashMap<String, String>();
resource.put(sysLocaleResource.getLanguageCode(), sysLocaleResource.getResourceValue());
redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + sysLocaleResource.getResourceKey(), resource, 0);
redisRes.putHashMap(CommonConstWords.REDIS_PREFIX_CACHE_LANGUAGE + ":" + sysLocaleResource.getResourceKey(), resource, 0);
}
}
}

@ -57,6 +57,7 @@ public class MessageMailQueueReceiver {
@RabbitListener(queues = PlatformConstWords.IMPP_MESSAGE_MAIL_QUEUE)
public void processImppMail(String data, Channel channel, Message message) {
SysMessage msg = JsonUtilTool.decode(data, SysMessage.class);
Long startTime = System.currentTimeMillis();
try {
LOGGER.info("【MQ-IMPP_MESSAGE_MAIL_QUEUE】数据接收成功{}", msg);
if (msg.getMessageSendTime() == null) {
@ -130,6 +131,8 @@ public class MessageMailQueueReceiver {
} catch (IOException e1) {
e1.printStackTrace();
}
} finally {
LOGGER.info("[Core Email] Email Id:{} , 耗时{}, Message Info :{}", msg.getId(), System.currentTimeMillis() - startTime, JSON.toJSONString(msg));
}
}
}

@ -4,6 +4,7 @@ import cn.estsh.i3plus.core.api.iservice.busi.ISysDictionaryService;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
import cn.estsh.i3plus.platform.common.tool.StringTool;
import cn.estsh.i3plus.pojo.base.bean.BaseConstWords;
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;
@ -66,6 +67,7 @@ public class SysDictionaryService implements ISysDictionaryService {
sysDictionary.setParentNameRdd(parentSysDictionary.getName());
sysDictionary.setParentCodeRdd(parentSysDictionary.getDictionaryCode());
sysDictionary.setDictionaryGroup(parentSysDictionary.getDictionaryGroup());
} else {
sysDictionary.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
}
@ -85,7 +87,7 @@ public class SysDictionaryService implements ISysDictionaryService {
@ApiOperation(value = "修改字典")
public void updateSysDictionary(SysDictionary sysDictionary) {
// 校验唯一
String hqlPack = CoreHqlPack.packHqlSysDictionaryCode(sysDictionary);
DdlPackBean hqlPack = CoreHqlPack.packHqlSysDictionaryCode(sysDictionary);
long repeatCodeCount = sysDictionaryRDao.findByHqlWhereCount(hqlPack);
if (sysDictionary.getParentIdVal() == CommonEnumUtil.PARENT.DEFAULT.getValue() &&repeatCodeCount > 0) {
throw ImppExceptionBuilder.newInstance()
@ -127,6 +129,7 @@ public class SysDictionaryService implements ISysDictionaryService {
newSysDict.setParentNameRdd(parentSysDictionary.getName());
newSysDict.setParentCodeRdd(parentSysDictionary.getDictionaryCode());
newSysDict.setDictionaryGroup(parentSysDictionary.getDictionaryGroup());
}
LOGGER.info("字典 SYS_DICTIONARY sysDictionary:{}", newSysDict);
@ -159,7 +162,7 @@ public class SysDictionaryService implements ISysDictionaryService {
public ListPager querySysDictionaryByPager(SysDictionary sysDictionary, Pager pager) {
sysDictionary = sysDictionary == null ? new SysDictionary() : sysDictionary;
String hqlPack = CoreHqlPack.packHqlSysDictionary(sysDictionary);
DdlPackBean hqlPack = CoreHqlPack.packHqlSysDictionaryPage(sysDictionary);
pager = PagerHelper.getPager(pager, sysDictionaryRDao.findByHqlWhereCount(hqlPack));
return new ListPager(sysDictionaryRDao.findByHqlWherePage(hqlPack + sysDictionary.orderBy(), pager), pager);
}
@ -248,4 +251,10 @@ public class SysDictionaryService implements ISysDictionaryService {
public List<SysDictionary> findSysDictionaryByParentId(Long parentId) {
return sysDictionaryRDao.findByProperty("parentId", parentId);
}
@Override
@ApiOperation(value = "按条件查询字典")
public List<SysDictionary> findSysDictionary(SysDictionary sysDictionary) {
return sysDictionaryRDao.findByHqlWhere(CoreHqlPack.packHqlSysDictionary(sysDictionary));
}
}

Loading…
Cancel
Save