wangyunpeng 2 недель назад
Родитель
Сommit
2d0a45768e

+ 29 - 24
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/job/NewMatchVideoJob.java

@@ -44,32 +44,37 @@ public class NewMatchVideoJob {
             return ReturnT.SUCCESS;
             return ReturnT.SUCCESS;
         }
         }
         for (MatchContentItem matchContentItem : matchContentItemList) {
         for (MatchContentItem matchContentItem : matchContentItemList) {
-            NewMatchVideoExample example = new NewMatchVideoExample();
-            example.createCriteria().andContentIdEqualTo(matchContentItem.getProduceContentId());
-            List<NewMatchVideo> newMatchVideos = newMatchVideoMapper.selectByExample(example);
-            if (CollectionUtils.isEmpty(newMatchVideos)) {
-                newMatchVideoService.addMatchVideo(matchContentItem);
-            } else {
-                NewMatchVideo newMatchVideo = newMatchVideos.get(0);
-                if (NewContentStatusEnum.isSuccess(newMatchVideo.getContentStatus())) {
-                    MatchContentStatusParam matchContentStatusParam = new MatchContentStatusParam();
-                    matchContentStatusParam.setProduceContentId(newMatchVideo.getContentId());
-                    matchContentStatusParam.setStatus(NewMatchResultStatusEnum.SUCCESS.getStatusCode());
-                    boolean res = aigcService.updateMatchContentStatus(matchContentStatusParam);
-                    if (res) {
-                        AuditContentRequest auditContentRequest = new AuditContentRequest();
-                        auditContentRequest.setContentId(newMatchVideo.getContentId());
-                        auditContentRequest.setFlowPoolLevel(newMatchVideo.getFlowPoolLevel());
-                        matchService.addAudit(auditContentRequest);
-                    }
+            try {
+                NewMatchVideoExample example = new NewMatchVideoExample();
+                example.createCriteria().andContentIdEqualTo(matchContentItem.getProduceContentId());
+                List<NewMatchVideo> newMatchVideos = newMatchVideoMapper.selectByExample(example);
+                if (CollectionUtils.isEmpty(newMatchVideos)) {
+                    newMatchVideoService.addMatchVideo(matchContentItem);
+                } else {
+                    NewMatchVideo newMatchVideo = newMatchVideos.get(0);
+                    if (NewContentStatusEnum.isSuccess(newMatchVideo.getContentStatus())) {
+                        MatchContentStatusParam matchContentStatusParam = new MatchContentStatusParam();
+                        matchContentStatusParam.setProduceContentId(newMatchVideo.getContentId());
+                        matchContentStatusParam.setStatus(NewMatchResultStatusEnum.SUCCESS.getStatusCode());
+                        boolean res = aigcService.updateMatchContentStatus(matchContentStatusParam);
+                        if (res) {
+                            AuditContentRequest auditContentRequest = new AuditContentRequest();
+                            auditContentRequest.setContentId(newMatchVideo.getContentId());
+                            auditContentRequest.setFlowPoolLevel(newMatchVideo.getFlowPoolLevel());
+                            matchService.addAudit(auditContentRequest);
+                        }
 
 
+                    }
+                    if (NewContentStatusEnum.isFail(newMatchVideo.getContentStatus())) {
+                        MatchContentStatusParam matchContentStatusParam = new MatchContentStatusParam();
+                        matchContentStatusParam.setProduceContentId(newMatchVideo.getContentId());
+                        matchContentStatusParam.setStatus(NewMatchResultStatusEnum.FAIL.getStatusCode());
+                        aigcService.updateMatchContentStatus(matchContentStatusParam);
+                    }
                 }
                 }
-                if (NewContentStatusEnum.isFail(newMatchVideo.getContentStatus())) {
-                    MatchContentStatusParam matchContentStatusParam = new MatchContentStatusParam();
-                    matchContentStatusParam.setProduceContentId(newMatchVideo.getContentId());
-                    matchContentStatusParam.setStatus(NewMatchResultStatusEnum.FAIL.getStatusCode());
-                    aigcService.updateMatchContentStatus(matchContentStatusParam);
-                }
+            } catch (Exception e) {
+                LarkRobotUtil.sendMessage("matchContentJob异常,contentId:"+matchContentItem.getProduceContentId()+", 请及时查看,<at user_id=\"g6732afb\">王云鹏</at>");
+                log.error("matchContentJob error", e);
             }
             }
         }
         }
         return ReturnT.SUCCESS;
         return ReturnT.SUCCESS;