Procházet zdrojové kódy

修改计划更新

xueyiming před 4 měsíci
rodič
revize
afc9dd5c89

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

@@ -11,6 +11,8 @@ public interface PlanAccountService {
 
     void saveOrUpdatePlan(Plan plan);
 
+    List<PlanAccount> getPlanAccountByPlanId(String planId);
+
     List<PlanAccount> getMatchPlanAccount();
 
     List<PlanAccount> getNormalPlanAccount();
@@ -21,6 +23,8 @@ public interface PlanAccountService {
 
     void delPlan(String planId);
 
+    void delAccount(String planId, String accountId);
+
     void updateMatchStatus(Integer status, Long id);
 
     void updateStatus(Integer status, Long id);

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

@@ -112,9 +112,12 @@ public class CoreServiceImpl implements CoreService {
                     miniStgMap.put(accountId, miniprogramInsertTaskParam);
                 }
             }
+            List<PlanAccount> planAccounts = planAccountService.getPlanAccountByPlanId(longArticleSystemPlan.getId());
+            Set<String> accountIdSet = planAccounts.stream().map(PlanAccount::getAccountId).collect(Collectors.toSet());
             for (LongArticleSystemPlanAccount account : longArticleSystemPlan.getAccountList()) {
                 PlanAccount planAccount = new PlanAccount();
                 String accountId = account.getId();
+                accountIdSet.remove(accountId);
                 planAccount.setPlanId(longArticleSystemPlan.getId());
                 planAccount.setPlanName(longArticleSystemPlan.getName());
                 planAccount.setAccountId(accountId);
@@ -144,6 +147,13 @@ public class CoreServiceImpl implements CoreService {
                 planAccount.setPushType(longArticleSystemPlan.getPushType());
                 planAccountService.saveOrUpdatePlanAccount(planAccount);
             }
+            if (CollectionUtils.isEmpty(accountIdSet)) {
+                continue;
+            }
+            for (String accountId : accountIdSet) {
+                planAccountService.delAccount(longArticleSystemPlan.getId(), accountId);
+            }
+
         }
         if (CollectionUtils.isEmpty(planIdSet)) {
             return;

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

@@ -53,6 +53,14 @@ public class PlanAccountServiceImpl implements PlanAccountService {
         }
     }
 
+    @Override
+    public List<PlanAccount> getPlanAccountByPlanId(String planId) {
+        PlanAccountExample example = new PlanAccountExample();
+        example.createCriteria().andPlanIdEqualTo(planId)
+                .andCreateTimeGreaterThan(DateUtil.getThatDayDate());
+        return planAccountMapper.selectByExample(example);
+    }
+
     public List<PlanAccount> getMatchPlanAccount() {
         PlanAccountExample example = new PlanAccountExample();
         example.createCriteria().andCreateTimeGreaterThan(DateUtil.getThatDayDate())
@@ -97,6 +105,18 @@ public class PlanAccountServiceImpl implements PlanAccountService {
         planAccountMapper.updateByExampleSelective(updatePlanAccount, planAccountExample);
     }
 
+    @Override
+    public void delAccount(String planId, String accountId) {
+        PlanAccountExample planAccountExample = new PlanAccountExample();
+        planAccountExample.createCriteria()
+                .andAccountIdEqualTo(accountId)
+                .andPlanIdEqualTo(planId).
+                andCreateTimeGreaterThan(DateUtil.getThatDayDate());
+        PlanAccount updatePlanAccount = new PlanAccount();
+        updatePlanAccount.setIsDelete(1);
+        planAccountMapper.updateByExampleSelective(updatePlanAccount, planAccountExample);
+    }
+
 
     @Override
     public void updateMatchStatus(Integer status, Long id) {