Commit 2ff045f1 by 陈健智

单账号登录限制补充

parent 781cd5ae
......@@ -6,6 +6,7 @@ import com.zhiwei.brandkbs2.dao.ChannelRecordRefreshTaskDao;
import com.zhiwei.brandkbs2.pojo.*;
import com.zhiwei.brandkbs2.service.ChannelService;
import com.zhiwei.brandkbs2.service.SystemInfoService;
import com.zhiwei.brandkbs2.util.RedisUtil;
import com.zhiwei.brandkbs2.util.Tools;
import com.zhiwei.middleware.automaticmark.graphs.Graphs;
import com.zhiwei.qbjc.bean.pojo.common.MessagePlatform;
......@@ -14,6 +15,7 @@ import com.zhiwei.brandkbs2.dao.HighlightWordDao;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
......@@ -54,6 +56,9 @@ public class GlobalPojo {
@Resource(name = "channelServiceImpl")
private ChannelService channelService;
@Autowired
private RedisUtil redisUtil;
/**
* 监测系统平台
**/
......@@ -133,6 +138,8 @@ public class GlobalPojo {
private void initPojo() throws IOException {
CHINA_AREA_TAGS = JSONArray.parseArray(Tools.readJsonFile(chinaAreaTag.getInputStream()));
deleteUserSessionInfo();
updateIncompleteChannelRecordTask();
}
private void updatePojo(String logMsg) {
......@@ -149,7 +156,6 @@ public class GlobalPojo {
COMMON_SENSITIVE_CHANNEL = systemInfoService.getCommonSensitiveChannel();
BYTEDANCE_CHANNEL_INFLUENCE = systemInfoService.getByteDanceChannelInfluence();
updateHighlightGraphs();
updateIncompleteChannelRecordTask();
log.info("{}-获取PLATFORMS-size:{},TAGS-size:{},LINKED_GROUP_ID_TAGS:{},CHANNEL_TAGS:{},MEDIA_TYPE:{},PROJECT_MAP:{},YUQING-PROJECTS-size:{},PROJECT_EMOTION_CHANNEL_DATA-size:{},PROJECT_SENSITIVE_CHANNEL-size:{}, COMMON_SENSITIVE_CHANNEL-size:{},BYTEDANCE_CHANNEL_INFLUENCE-size:{}", logMsg, PLATFORMS.size(), TAGS.size(),
LINKED_GROUP_ID_TAGS.size(), CHANNEL_TAGS.size(), MEDIA_TYPE.size(), PROJECT_MAP.size(), YU_QING_PROJECTS.size(), PROJECT_EMOTION_CHANNEL_DATA.size(), PROJECT_SENSITIVE_CHANNEL.size(), COMMON_SENSITIVE_CHANNEL.size(), BYTEDANCE_CHANNEL_INFLUENCE.size());
} catch (Exception e) {
......@@ -157,6 +163,9 @@ public class GlobalPojo {
}
}
/**
* 重启未完成的渠道记录更新任务
*/
private void updateIncompleteChannelRecordTask(){
List<ChannelRecordRefreshTask> tasks = channelRecordRefreshTaskDao.findList(new Query(Criteria.where("status").is(ChannelRecordRefreshTask.TaskStatus.UPDATING.getStatus())));
if (CollectionUtils.isEmpty(tasks)){
......@@ -170,6 +179,14 @@ public class GlobalPojo {
}
}
/**
* 清空用户sessionId缓存
*/
private void deleteUserSessionInfo(){
Set<String> keys = redisUtil.keys(RedisKeyPrefix.USER_SESSION + "*");
redisUtil.delete(keys);
}
private void updateHighlightGraphs() {
PROJECT_MAP.forEach((key, project) -> {
String id = project.getId();
......
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