package com.pj.project.tb_business; import com.pj.utils.cache.RedisUtil; import org.springframework.stereotype.Component; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @Component public class BusinessMessageManager { private static String MES_PREFIX = "b_m:"; private static long EXP_TIME_SECOND = 24 * 60; public static void set(String customerId, String content) { List list = RedisUtil.forListGet(MES_PREFIX + customerId); ListcheckList=list.stream().map(Object::toString).collect(Collectors.toList()); if (checkList.contains(content)) { return; } RedisUtil.forListAdd(MES_PREFIX + customerId, content); } public static List get(String customerId) { List list = RedisUtil.forListGet(MES_PREFIX + customerId); RedisUtil.forListRemove(MES_PREFIX+customerId); return list == null ? Collections.emptyList() : list.stream().map(Object::toString).collect(Collectors.toList()); } }