Selaa lähdekoodia

公众号计划修改

wangyunpeng 2 kuukautta sitten
vanhempi
commit
379f6f881a

+ 1 - 1
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/ContentPlatformPlanService.java

@@ -68,5 +68,5 @@ public interface ContentPlatformPlanService {
 
     void qwPlanImport(List<String> channels);
 
-    void gzhUpdateStagePublishStatus(Long id);
+    void gzhUpdateStagePublishStatus(Long id, Integer stagePublishStatus);
 }

+ 22 - 3
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -194,8 +194,21 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
 
 
     @Override
-    public void gzhUpdateStagePublishStatus(Long id) {
-
+    public void gzhUpdateStagePublishStatus(Long id, Integer stagePublishStatus) {
+        ContentPlatformGzhPlan plan = gzhPlanMapper.selectByPrimaryKey(id);
+        if (Objects.isNull(plan)) {
+            throw new CommonException(ExceptionEnum.GZH_PLAN_NOT_EXISTS);
+        }
+        if (!Objects.equals(LoginUserContext.getUser().getId(), plan.getCreateAccountId())) {
+            throw new CommonException(ExceptionEnum.PARAM_ERROR);
+        }
+        plan.setStagePublishStatus(stagePublishStatus);
+        plan.setUpdateTimestamp(System.currentTimeMillis());
+        gzhPlanMapper.updateByPrimaryKeySelective(plan);
+        ContentPlatformGzhAccount gzhAccount = cooperateAccountService.getById(plan.getAccountId());
+        if (StringUtils.hasText(plan.getExternalId()) && StringUtils.hasText(gzhAccount.getExternalId())) {
+            aigcApiService.changePublishPlanAccountStatus(plan.getExternalId(), gzhAccount.getExternalId(), stagePublishStatus);
+        }
     }
 
     @Override
@@ -568,7 +581,7 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
             Long now = System.currentTimeMillis();
             List<GhDetail> ghDetailList = ghDetailService.getByChannel(account.getChannel());
             ghDetailList = ghDetailList.stream()
-                    .filter(o -> Objects.equals(o.getStrategyStatus(), StrategyStatusEnum.DEFAULT.status))
+                    .filter(o -> Objects.equals(o.getStrategyStatus(), StrategyStatusEnum.STRATEGY.status))
                     .collect(Collectors.toList());
             if (CollectionUtils.isEmpty(ghDetailList)) {
                 continue;
@@ -586,18 +599,24 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
                     continue;
                 }
                 gzhPlan.setAccountId(gzhAccount.getId());
+                gzhPlan.setType(0);
                 gzhPlan.setScene(0);
+                gzhPlan.setSelectVideoType(1);
                 gzhPlan.setPublishStage(PublishStageEnum.USER.getVal());
                 if (StringUtils.hasText(gzhAccount.getExternalId())) {
                     aigcApiService.closeAccountMessagePublishPlan(gzhAccount.getExternalId());
                     gzhPlan.setPublishStage(PublishStageEnum.PLATFORM.getVal());
                     String externalId = aigcApiService.createPublishPlan(gzhAccount.getExternalId(), gzhAccount.getName(), account.getChannel());
                     gzhPlan.setExternalId(externalId);
+                    gzhPlan.setStagePublishStatus(1);
                 }
                 gzhPlan.setCreateAccountId(account.getId());
                 gzhPlan.setCreateTimestamp(now);
                 gzhPlan.setUpdateTimestamp(now);
                 planMapperExt.insertGzhPlanReturnId(gzhPlan);
+                if (!StringUtils.hasText(ghDetail.getVideoIds())) {
+                    continue;
+                }
                 List<Long> videoIds = JSONObject.parseArray(ghDetail.getVideoIds(), Long.class);
                 Map<Long, VideoDetail> videoMap = messageAttachmentService.getVideoDetail(new HashSet<>(videoIds));
                 for (Map.Entry<Long, VideoDetail> entry : videoMap.entrySet()) {