...
|
...
|
@@ -8,6 +8,7 @@ import java.util.stream.Collectors; |
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.yoho.core.config.ConfigReader;
|
|
|
import com.yohoufo.common.helper.NoticeMessageFormatter;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
...
|
...
|
@@ -95,7 +96,7 @@ public class InBoxServiceImpl implements IInBoxService { |
|
|
Map<Integer, TypeCountInbox> result = new HashMap<>();
|
|
|
for(InboxTypeEnum typeEnum : InboxTypeEnum.values()) {
|
|
|
TypeCountInbox inbox = new TypeCountInbox();
|
|
|
int count = inBoxDao.selectTypeCount(tableName, uid, isRead, isDel, typeEnum.getId());
|
|
|
int count = inBoxDao.selectTypeCount(tableName, uid, isRead, isDel, typeEnum.getId(),getUnreadBeginTime());
|
|
|
inbox.setCount(count);
|
|
|
inbox.setType(typeEnum.getId());
|
|
|
result.put(typeEnum.getId(), inbox);
|
...
|
...
|
@@ -271,7 +272,7 @@ public class InBoxServiceImpl implements IInBoxService { |
|
|
private void updateReaded(ListInboxReqVO reqVO){
|
|
|
if(null != reqVO.getType()){
|
|
|
log.info("listInboxByTypes updateReadedByUidAndType param is {}", reqVO);
|
|
|
inBoxDao.updateReadedByUidAndType(getTableName(reqVO.getUid()),reqVO.getUid(),reqVO.getType(),DateUtil.getCurrentTimeSecond());
|
|
|
inBoxDao.updateReadedByUidAndType(getTableName(reqVO.getUid()),reqVO.getUid(),reqVO.getType(),DateUtil.getCurrentTimeSecond(),getUnreadBeginTime());
|
|
|
RedisKeyBuilder key = CacheEnum.USERS_INBOX_TYPE_UNREADCOUNT.generateKey(reqVO.getUid(),reqVO.getType());
|
|
|
redisTemplate.delete(key);
|
|
|
}
|
...
|
...
|
@@ -437,4 +438,18 @@ public class InBoxServiceImpl implements IInBoxService { |
|
|
return "inbox_" + uid % 10;
|
|
|
}
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
private ConfigReader configReader;
|
|
|
// 未读记录的开始时间
|
|
|
private int getUnreadBeginTime() {
|
|
|
String daysStr = configReader.getString("ufo.users.messageUnreadDays", "7");
|
|
|
try {
|
|
|
int days = Integer.parseInt(daysStr.trim());
|
|
|
return (int) (System.currentTimeMillis() / 1000) - days * 24 * 3600;
|
|
|
} catch (NumberFormatException e) {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|