Commit f3bcd67a by liuyu

2024/05/06 转移模板添加分布式锁

parent 63cf5909
...@@ -188,6 +188,7 @@ public class TemplateTitleServiceImpl implements TemplateTitleService { ...@@ -188,6 +188,7 @@ public class TemplateTitleServiceImpl implements TemplateTitleService {
public void transferTemplate(String group, TemplateTitleVo templateTitleVo) { public void transferTemplate(String group, TemplateTitleVo templateTitleVo) {
String lockKey = Tools.assembleKey(GenericAttribute.LOCK, templateTitleVo.getTemplateTitle()); String lockKey = Tools.assembleKey(GenericAttribute.LOCK, templateTitleVo.getTemplateTitle());
try { try {
redissonUtil.tryLock(lockKey, 5, 5);
templateTitleVo.setDaySum(0L); templateTitleVo.setDaySum(0L);
redissonUtil.setMapValue(Tools.assembleKey(GenericAttribute.REDIS_MAP_LOSE_KEY, group), templateTitleVo.getTemplateTitle(), JSONObject.toJSONString(templateTitleVo)); redissonUtil.setMapValue(Tools.assembleKey(GenericAttribute.REDIS_MAP_LOSE_KEY, group), templateTitleVo.getTemplateTitle(), JSONObject.toJSONString(templateTitleVo));
redissonUtil.removeMapValue(Tools.assembleKey(GenericAttribute.REDIS_MAP_KEY, group), templateTitleVo.getTemplateTitle()); redissonUtil.removeMapValue(Tools.assembleKey(GenericAttribute.REDIS_MAP_KEY, group), templateTitleVo.getTemplateTitle());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment