|
@@ -150,7 +150,7 @@ public class ArticleVideoAuditService {
|
|
|
|
|
|
long now = System.currentTimeMillis();
|
|
|
String id;
|
|
|
- String nextListRedisKey = "article-pool-audit-next-list";
|
|
|
+ String inAuditListRedisKey = "article-pool-in-audit-list";
|
|
|
ArticleVideoAuditListVO item = null;
|
|
|
try {
|
|
|
String dateStr = DateUtils.getCurrentDateStr("yyyyMMdd");
|
|
@@ -158,7 +158,7 @@ public class ArticleVideoAuditService {
|
|
|
// 从待审核队列中获取数据,如未获取到则从数据库查询一条
|
|
|
Long size = redisTemplate.opsForZSet().size(auditQueueRedisKey);
|
|
|
if (Objects.isNull(size) || size == 0) {
|
|
|
- Map<Object, Object> entries = redisTemplate.opsForHash().entries(nextListRedisKey);
|
|
|
+ Map<Object, Object> entries = redisTemplate.opsForHash().entries(inAuditListRedisKey);
|
|
|
List<String> excludeContentIds = new ArrayList<>();
|
|
|
entries.forEach((k, v) -> {
|
|
|
excludeContentIds.add((String) k);
|
|
@@ -195,7 +195,7 @@ public class ArticleVideoAuditService {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("id", item.getContentId());
|
|
|
json.put("timestamp", now + (15 * 60 * 1000));
|
|
|
- redisTemplate.opsForList().rightPush(nextListRedisKey, json.toJSONString());
|
|
|
+ redisTemplate.opsForList().rightPush(inAuditListRedisKey, json.toJSONString());
|
|
|
List<ArticleVideoAuditListVO> list = Collections.singletonList(item);
|
|
|
buildArticleVideoAuditListVO(list);
|
|
|
result.setObjs(list);
|
|
@@ -218,7 +218,7 @@ public class ArticleVideoAuditService {
|
|
|
}
|
|
|
// 当日审核数+1
|
|
|
addAuditCount(titleAudit.getFlowPoolLevel());
|
|
|
- redisTemplate.opsForHash().delete("article-pool-audit-next-list", titleAudit.getContentId());
|
|
|
+ redisTemplate.opsForHash().delete("article-pool-in-audit-list", titleAudit.getContentId());
|
|
|
}
|
|
|
|
|
|
private void addAuditCount(String poolLevel) {
|
|
@@ -426,17 +426,17 @@ public class ArticleVideoAuditService {
|
|
|
try {
|
|
|
Long now = System.currentTimeMillis();
|
|
|
String dateStr = DateUtils.getCurrentDateStr("yyyyMMdd");
|
|
|
- String nextListRedisKey = "article-pool-audit-next-list";
|
|
|
+ String inAuditListRedisKey = "article-pool-in-audit-list";
|
|
|
String auditQueueRedisKey = "article-pool-audit-queue-" + dateStr;
|
|
|
// 判断是否审核超时,重新加入待审核队列
|
|
|
while (true) {
|
|
|
- List<String> nextList = redisTemplate.opsForList().range(nextListRedisKey, 0, 0);
|
|
|
- if (CollectionUtils.isEmpty(nextList)) {
|
|
|
+ List<String> inAuditList = redisTemplate.opsForList().range(inAuditListRedisKey, 0, 0);
|
|
|
+ if (CollectionUtils.isEmpty(inAuditList)) {
|
|
|
break;
|
|
|
}
|
|
|
- JSONObject firstObj = JSONObject.parseObject(nextList.get(0));
|
|
|
+ JSONObject firstObj = JSONObject.parseObject(inAuditList.get(0));
|
|
|
if (now > firstObj.getLong("timestamp")) {
|
|
|
- redisTemplate.opsForList().leftPop(nextListRedisKey);
|
|
|
+ redisTemplate.opsForList().leftPop(inAuditListRedisKey);
|
|
|
String id = firstObj.getString("id");
|
|
|
LongArticleTitleAudit videoAudit = titleAuditRepository.getByContentId(id);
|
|
|
ContentPoolEnum poolEnum = ContentPoolEnum.from(videoAudit.getFlowPoolLevel());
|
|
@@ -446,14 +446,16 @@ public class ArticleVideoAuditService {
|
|
|
}
|
|
|
}
|
|
|
List<String> excludeContentIds = new ArrayList<>();
|
|
|
- List<String> nextList = redisTemplate.opsForList().range(nextListRedisKey, 0, -1);
|
|
|
- Map<String, List<LongArticleTitleAudit>> nextListPoolCountMap = new HashMap<>();
|
|
|
- if (CollectionUtils.isNotEmpty(nextList)) {
|
|
|
- List<String> nextListIds = nextList.stream().map(item -> JSONObject.parseObject(item).getString("id")).collect(Collectors.toList());
|
|
|
- List<LongArticleTitleAudit> auditQueueList = titleAuditRepository.getByContentIdIn(new ArrayList<>(nextListIds));
|
|
|
- nextListPoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
|
|
|
- excludeContentIds.addAll(nextListIds);
|
|
|
+ // 审核中列表获取,按内容池分组
|
|
|
+ List<String> inAuditList = redisTemplate.opsForList().range(inAuditListRedisKey, 0, -1);
|
|
|
+ Map<String, List<LongArticleTitleAudit>> inAuditListPoolCountMap = new HashMap<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(inAuditList)) {
|
|
|
+ List<String> inAuditListIds = inAuditList.stream().map(item -> JSONObject.parseObject(item).getString("id")).collect(Collectors.toList());
|
|
|
+ List<LongArticleTitleAudit> auditQueueList = titleAuditRepository.getByContentIdIn(new ArrayList<>(inAuditListIds));
|
|
|
+ inAuditListPoolCountMap = auditQueueList.stream().collect(Collectors.groupingBy(item -> ContentPoolEnum.from(item.getFlowPoolLevel()).getContentPool()));
|
|
|
+ excludeContentIds.addAll(inAuditListIds);
|
|
|
}
|
|
|
+ // 待审核列表获取,按内容池分组
|
|
|
Set<String> auditQueueIds = redisTemplate.opsForZSet().rangeByScore(auditQueueRedisKey, 0, 100);
|
|
|
Map<String, List<LongArticleTitleAudit>> auditQueuePoolCountMap = new HashMap<>();
|
|
|
if (CollectionUtils.isNotEmpty(auditQueueIds)) {
|
|
@@ -468,8 +470,8 @@ public class ArticleVideoAuditService {
|
|
|
int totalCount = Integer.parseInt(Optional.ofNullable(redisTemplate.opsForValue().get(key)).orElse("0"));
|
|
|
if (totalCount < entry.getValue()) {
|
|
|
List<LongArticleTitleAudit> auditQueueList = auditQueuePoolCountMap.getOrDefault(poolEnum.getContentPool(), new ArrayList<>());
|
|
|
- List<LongArticleTitleAudit> nextListPool = nextListPoolCountMap.getOrDefault(poolEnum.getContentPool(), new ArrayList<>());
|
|
|
- int needCount = entry.getValue() - (totalCount + auditQueueList.size() + nextListPool.size());
|
|
|
+ List<LongArticleTitleAudit> inAuditListPool = inAuditListPoolCountMap.getOrDefault(poolEnum.getContentPool(), new ArrayList<>());
|
|
|
+ int needCount = entry.getValue() - (totalCount + auditQueueList.size() + inAuditListPool.size());
|
|
|
if (needCount > 0) {
|
|
|
List<ArticleVideoAuditListVO> addList = articleAuditMapper.articleVideoWatingAuditList(
|
|
|
Arrays.asList(ArticleVideoAuditStatusEnum.WAITING.getCode()),
|