Procházet zdrojové kódy

例外设置更新

xueyiming před 5 měsíci
rodič
revize
1ba152743e

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

@@ -853,19 +853,22 @@ public class CoreServiceImpl implements CoreService {
         //额外发送
         for (AccountSpecialSettings accountSpecialSetting : sendAccountSpecialSettings) {
             List<PlanAccount> specialPlanAccount = planAccountService.getSpecialPlanAccount(accountSpecialSetting.getAccountId());
-            if (!CollectionUtils.isEmpty(specialPlanAccount)) {
-                continue;
-            }
-            List<PlanAccount> planAccountList = planAccountService.getNormalPlanAccount(accountSpecialSetting.getAccountId());
-            if (CollectionUtils.isEmpty(planAccountList)) {
-                continue;
+            if (CollectionUtils.isEmpty(specialPlanAccount)) {
+                List<PlanAccount> planAccountList = planAccountService.getNormalPlanAccount(accountSpecialSetting.getAccountId());
+                if (CollectionUtils.isEmpty(planAccountList)) {
+                    continue;
+                }
+                Optional<PlanAccount> firstAccount = planAccountList.stream().min((a1, a2) -> -a1.getPublishNum().compareTo(a2.getPublishNum()));
+                PlanAccount targetPlanAccount = firstAccount.get();
+                updateAccountSetting(accountSpecialSetting, targetPlanAccount);
+                targetPlanAccount.setIsSpecialSetting(1);
+                targetPlanAccount.setId(null);
+                planAccountService.saveOrUpdatePlanAccount(targetPlanAccount);
+            } else {
+                PlanAccount planAccount = specialPlanAccount.get(0);
+                updateAccountSetting(accountSpecialSetting, planAccount);
+                planAccountService.saveOrUpdatePlanAccount(planAccount);
             }
-            Optional<PlanAccount> firstAccount = planAccountList.stream().min((a1, a2) -> -a1.getPublishNum().compareTo(a2.getPublishNum()));
-            PlanAccount targetPlanAccount = firstAccount.get();
-            updateAccountSetting(accountSpecialSetting, targetPlanAccount);
-            targetPlanAccount.setIsSpecialSetting(1);
-            targetPlanAccount.setId(null);
-            planAccountService.saveOrUpdatePlanAccount(targetPlanAccount);
         }
     }