|
@@ -16,10 +16,7 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
@Slf4j
|
|
@@ -40,6 +37,7 @@ public class ContentServiceImpl implements ContentService {
|
|
|
@Autowired
|
|
|
private PublishContentMapper publishContentMapper;
|
|
|
|
|
|
+
|
|
|
public MatchVideo getContent(String contentId, String ghId, Integer publishFlag) {
|
|
|
MatchVideoExample matchVideoExample = new MatchVideoExample();
|
|
|
matchVideoExample.createCriteria().andGhIdEqualTo(ghId).andContentIdEqualTo(contentId)
|
|
@@ -61,24 +59,34 @@ public class ContentServiceImpl implements ContentService {
|
|
|
return publishMiniprograms;
|
|
|
}
|
|
|
|
|
|
- public String updateMatchContent(String contentId, String ghId, JSONArray jsonArray, Integer publishFlag) {
|
|
|
- MatchVideoExample matchVideoExample = new MatchVideoExample();
|
|
|
- matchVideoExample.createCriteria().andGhIdEqualTo(ghId).andContentIdEqualTo(contentId)
|
|
|
- .andPublishFlagEqualTo(publishFlag);
|
|
|
- List<MatchVideo> matchVideos = matchVideoMapper.selectByExample(matchVideoExample);
|
|
|
- if (CollectionUtils.isEmpty(matchVideos)) {
|
|
|
- return null;
|
|
|
+ public void updateMatchContent(PublishContent publishContent, String ghId, JSONArray jsonArray) {
|
|
|
+ try {
|
|
|
+ MatchVideoExample matchVideoExample = new MatchVideoExample();
|
|
|
+ matchVideoExample.createCriteria().andGhIdEqualTo(ghId).andContentIdEqualTo(publishContent.getSourceId())
|
|
|
+ .andPublishFlagIn(Arrays.asList(1, 2));
|
|
|
+ matchVideoExample.setOrderByClause("publish_flag desc");
|
|
|
+ List<MatchVideo> matchVideos = matchVideoMapper.selectByExample(matchVideoExample);
|
|
|
+ if (CollectionUtils.isEmpty(matchVideos)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String traceId = matchVideos.get(0).getTraceId();
|
|
|
+ MatchVideo matchVideo = matchVideos.get(0);
|
|
|
+ MatchVideo updateMatchVideo = new MatchVideo();
|
|
|
+ updateMatchVideo.setId(matchVideo.getId());
|
|
|
+ updateMatchVideo.setContentStatus(4);
|
|
|
+ updateMatchVideo.setPublishFlag(2);
|
|
|
+ updateMatchVideo.setResponse(jsonArray.toJSONString());
|
|
|
+ matchVideoMapper.updateByPrimaryKeySelective(updateMatchVideo);
|
|
|
+ updatePublishContentTraceId(traceId, publishContent.getId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("updateMatchContent error", e);
|
|
|
}
|
|
|
- MatchVideo matchVideo = matchVideos.get(0);
|
|
|
- MatchVideo updateMatchVideo = new MatchVideo();
|
|
|
- updateMatchVideo.setId(matchVideo.getId());
|
|
|
- updateMatchVideo.setContentStatus(4);
|
|
|
- updateMatchVideo.setResponse(jsonArray.toJSONString());
|
|
|
- matchVideoMapper.updateByPrimaryKeySelective(updateMatchVideo);
|
|
|
- return matchVideo.getTraceId();
|
|
|
}
|
|
|
|
|
|
public void updatePublishContentTraceId(String traceId, Long publishContentId) {
|
|
|
+ if (StringUtils.isEmpty(traceId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
PublishContent publishContent = new PublishContent();
|
|
|
publishContent.setTraceId(traceId);
|
|
|
publishContent.setId(publishContentId);
|