Ver código fonte

Merge pull request '添加定时任务刷新缓存 因为该项目部署了两个服务 导致缓存不同步' (#12) from dev into master

Reviewed-on: http://47.92.149.153:3000/tangzp/mztb-parent/pulls/12
master
唐周平 8 meses atrás
pai
commit
7d1841454b
2 arquivos alterados com 38 adições e 6 exclusões
  1. +12
    -6
      mztb/src/main/java/cc/smtweb/biz/mztb/web/controller/MztbController.java
  2. +26
    -0
      mztb/src/main/java/cc/smtweb/biz/mztb/web/task/FlushRedisTask.java

+ 12
- 6
mztb/src/main/java/cc/smtweb/biz/mztb/web/controller/MztbController.java Ver arquivo

@@ -203,12 +203,18 @@ public class MztbController {
+ " SET srg_party_id = CONCAT(srg_party_id,',' ,'" + String.join(",", ptIdList) + "') where srg_id = ? ", 927515588790587392L); // 角色组填报员
}
// 将机构、用户信息放入缓存,或者刷新缓存
PartyCache.getInstance().putList(sysPartyList);
UserCache.getInstance().putList(userList);
UserPartyCache.getInstance().putList(userPartyList);
DeptCache.getInstance().putList(deptList);
UserRoleCache.getInstance().putList(userRoleList);
UserStatuCache.getInstance().putList(userStatuList);
// PartyCache.getInstance().putList(sysPartyList);
PartyCache.getInstance().refresh();
// UserCache.getInstance().putList(userList);
UserCache.getInstance().refresh();
// UserPartyCache.getInstance().putList(userPartyList);
UserPartyCache.getInstance().refresh();
// DeptCache.getInstance().putList(deptList);
DeptCache.getInstance().refresh();
// UserRoleCache.getInstance().putList(userRoleList);
UserRoleCache.getInstance().refresh();
// UserStatuCache.getInstance().putList(userStatuList);
UserStatuCache.getInstance().refresh();
RoleGroupCache.getInstance().refresh();
log.debug("机构缓存刷新完成!");
});


+ 26
- 0
mztb/src/main/java/cc/smtweb/biz/mztb/web/task/FlushRedisTask.java Ver arquivo

@@ -0,0 +1,26 @@
package cc.smtweb.biz.mztb.web.task;

import cc.smtweb.system.bpm.util.UtilLogger;
import cc.smtweb.system.bpm.web.sys.base.job.BaseJob;
import cc.smtweb.system.bpm.web.sys.user.dept.DeptCache;
import cc.smtweb.system.bpm.web.sys.user.party.PartyCache;
import cc.smtweb.system.bpm.web.sys.user.role.group.RoleGroupCache;
import cc.smtweb.system.bpm.web.sys.user.user.UserCache;
import cc.smtweb.system.bpm.web.sys.user.user.UserPartyCache;
import cc.smtweb.system.bpm.web.sys.user.user.UserRoleCache;
import cc.smtweb.system.bpm.web.sys.user.user.UserStatuCache;

public class FlushRedisTask extends BaseJob {
@Override
protected String work() {
PartyCache.getInstance().refresh();
UserCache.getInstance().refresh();
UserPartyCache.getInstance().refresh();
DeptCache.getInstance().refresh();
UserRoleCache.getInstance().refresh();
UserStatuCache.getInstance().refresh();
RoleGroupCache.getInstance().refresh();
UtilLogger.info("定时任务刷新缓存完成。。");
return null;
}
}

Carregando…
Cancelar
Salvar