Prechádzať zdrojové kódy

例外设置 已有账号发布 则不再发布

xueyiming 5 mesiacov pred
rodič
commit
cb6b16fcbd

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

@@ -33,5 +33,5 @@ public interface PlanAccountService {
 
     void updateRetry(PlanAccount planAccount);
 
-    List<PlanAccount> getNormalPlanAccount(String accountId);
+    List<PlanAccount> getPlanAccount(String accountId);
 }

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

@@ -218,7 +218,19 @@ public class CoreServiceImpl implements CoreService {
                 LarkRobotUtil.sendMessage("获取例外设置失败,accountId=" + accountId);
                 continue;
             }
-            List<PlanAccount> normalPlanAccounts = planAccountService.getNormalPlanAccount(accountId);
+            boolean isSend = false;
+            List<PlanAccount> planAccountList = planAccountService.getPlanAccount(accountId);
+            for (PlanAccount planAccount : planAccountList) {
+                int sendCount = publicContentService.getSendCount(planAccount.getId());
+                if (sendCount > 0) {
+                    isSend = true;
+                    break;
+                }
+            }
+            if (isSend) {
+                continue;
+            }
+            List<PlanAccount> normalPlanAccounts = planAccountList.stream().filter(e -> e.getIsDelete() == 0).filter(e -> e.getPublishOpenFlag() == 1).collect(Collectors.toList());
             if (CollectionUtils.isEmpty(normalPlanAccounts)) {
                 Optional<PlanAccount> firstAccount = planAccounts.stream().min((a1, a2) -> -a1.getPublishNum().compareTo(a2.getPublishNum()));
                 if (!firstAccount.isPresent()) {

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

@@ -146,10 +146,9 @@ public class PlanAccountServiceImpl implements PlanAccountService {
         planAccountMapper.updateByPrimaryKeySelective(updatePlanAccount);
     }
 
-    public List<PlanAccount> getNormalPlanAccount(String accountId) {
+    public List<PlanAccount> getPlanAccount(String accountId) {
         PlanAccountExample example = new PlanAccountExample();
         example.createCriteria().andCreateTimeGreaterThan(DateUtil.getThatDayDate())
-                .andIsDeleteEqualTo(0).andPublishOpenFlagEqualTo(1)
                 .andAccountIdEqualTo(accountId);
         return planAccountMapper.selectByExample(example);
     }