Explorar o código

无限发表支持重复多次发布

wangyunpeng hai 11 horas
pai
achega
c749cfe5b2

+ 2 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/PlanAccountService.java

@@ -14,6 +14,8 @@ public interface PlanAccountService {
 
     void saveOrUpdatePlanAccount(PlanAccount planAccount, LongArticleSystemPlanAccount account);
 
+    void saveOrUpdateWuXianLiuPlanAccount(PlanAccount planAccount, LongArticleSystemPlanAccount account);
+
     void saveOrUpdatePlan(Plan plan);
 
     List<PlanAccount> getPlanAccountByPlanId(String planId);

+ 7 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -235,7 +235,13 @@ public class CoreServiceImpl implements CoreService {
                 if (!CollectionUtils.isEmpty(specialAccountIds) && specialAccountIds.contains(planAccount.getAccountId())) {
                     planAccount.setSpecialNotSend(SpecialNotSendEnum.NOT_SEND.getStatusCode());
                 }
-                planAccountService.saveOrUpdatePlanAccount(planAccount, account);
+                if (Objects.equals(planAccount.getPushType(), PublishGzhPushTypeEnum.auto_publish.getVal())
+                        && StringUtils.isNotEmpty(planAccount.getPublishWindowStart())
+                        && StringUtils.isNotEmpty(planAccount.getPublishWindowEnd())) {
+                    planAccountService.saveOrUpdateWuXianLiuPlanAccount(planAccount, account);
+                } else {
+                    planAccountService.saveOrUpdatePlanAccount(planAccount, account);
+                }
             }
             if (CollectionUtils.isEmpty(accountIdSet)) {
                 continue;

+ 24 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/PlanAccountServiceImpl.java

@@ -39,6 +39,7 @@ public class PlanAccountServiceImpl implements PlanAccountService {
         planAccountMapper.updateByPrimaryKeySelective(planAccount);
     }
 
+    @Override
     public void saveOrUpdatePlanAccount(PlanAccount planAccount, LongArticleSystemPlanAccount account) {
         PlanAccountExample example = new PlanAccountExample();
         example.createCriteria().andAccountIdEqualTo(planAccount.getAccountId())
@@ -57,6 +58,29 @@ public class PlanAccountServiceImpl implements PlanAccountService {
         }
     }
 
+    @Override
+    public void saveOrUpdateWuXianLiuPlanAccount(PlanAccount planAccount, LongArticleSystemPlanAccount account) {
+        PlanAccountExample example = new PlanAccountExample();
+        example.createCriteria().andAccountIdEqualTo(planAccount.getAccountId())
+                .andPlanIdEqualTo(planAccount.getPlanId())
+                .andCreateTimeGreaterThan(DateUtil.getThatDayDate())
+                .andStatusEqualTo(0)
+                .andIsDeleteEqualTo(0)
+                .andPublishOpenFlagEqualTo(1);
+
+        List<PlanAccount> planAccounts = planAccountMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(planAccounts)) {
+            planAccountMapper.insertSelective(planAccount);
+            if (PublishGzhPushTypeEnum.batch_group_publish.getVal().equals(planAccount.getPushType())) {
+                new Thread(() -> sortService.addBatchGroupGZH(account.getGhId(), account.getAppId())).start();
+            }
+        } else {
+            planAccount.setId(planAccounts.get(0).getId());
+            planAccount.setIsDelete(0);
+            planAccountMapper.updateByPrimaryKeySelective(planAccount);
+        }
+    }
+
     @Override
     public void saveOrUpdatePlan(Plan plan) {
         PlanExample example = new PlanExample();