Sfoglia il codice sorgente

增加计划信息

xueyiming 8 mesi fa
parent
commit
72788e2ce4

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

@@ -13,8 +13,12 @@ public interface PlanAccountService {
 
     List<PlanAccount> getMatchPlanAccount();
 
+    List<PlanAccount> getNormalPlanAccount();
+
     List<Plan> getPlanList();
 
+    void delPlan(String planId);
+
     void updateMatchStatus(Integer status, Long id);
 
     void updateStatus(Integer status, Long id);

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

@@ -136,10 +136,12 @@ public class CoreServiceImpl implements CoreService {
                 planAccountService.saveOrUpdatePlanAccount(planAccount);
             }
         }
-        if(CollectionUtils.isEmpty(planIdSet)){
+        if (CollectionUtils.isEmpty(planIdSet)) {
             return;
         }
-        //TODO  更新计划状态和计划账号为删除
+        for (String planId : planIdSet) {
+            planAccountService.delPlan(planId);
+        }
     }
 
     private Plan createPlan(LongArticleSystemPlan longArticleSystemPlan) {
@@ -328,9 +330,10 @@ public class CoreServiceImpl implements CoreService {
 
     @Override
     public void core() {
-        PlanAccountExample example = new PlanAccountExample();
-        example.createCriteria().andCreateTimeGreaterThan(DateUtil.getThatDayDate()).andStatusEqualTo(0);
-        List<PlanAccount> planAccounts = planAccountMapper.selectByExample(example);
+        List<PlanAccount> planAccounts = planAccountService.getNormalPlanAccount();
+        if (CollectionUtils.isEmpty(planAccounts)) {
+            return;
+        }
         for (PlanAccount planAccount : planAccounts) {
             boolean flag = checkPlanAccount(planAccount);
             if (!flag) {

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

@@ -34,6 +34,7 @@ public class PlanAccountServiceImpl implements PlanAccountService {
             planAccountMapper.insertSelective(planAccount);
         } else {
             planAccount.setId(planAccounts.get(0).getId());
+            planAccount.setIsDelete(0);
             planAccountMapper.updateByPrimaryKeySelective(planAccount);
         }
     }
@@ -47,6 +48,7 @@ public class PlanAccountServiceImpl implements PlanAccountService {
             planMapper.insertSelective(plan);
         } else {
             plan.setId(plans.get(0).getId());
+            plan.setIsDelete(0);
             planMapper.updateByPrimaryKeySelective(plan);
         }
     }
@@ -58,6 +60,13 @@ public class PlanAccountServiceImpl implements PlanAccountService {
         return planAccountMapper.selectByExample(example);
     }
 
+    public List<PlanAccount> getNormalPlanAccount() {
+        PlanAccountExample example = new PlanAccountExample();
+        example.createCriteria().andCreateTimeGreaterThan(DateUtil.getThatDayDate())
+                .andStatusEqualTo(0).andIsDeleteEqualTo(0);
+        return planAccountMapper.selectByExample(example);
+    }
+
     public List<Plan> getPlanList() {
         PlanExample example = new PlanExample();
         List<Plan> plans = planMapper.selectByExample(example);
@@ -67,8 +76,18 @@ public class PlanAccountServiceImpl implements PlanAccountService {
         return plans;
     }
 
-    public void delPlan(String planId){
+    public void delPlan(String planId) {
+        PlanExample planExample = new PlanExample();
+        planExample.createCriteria().andPlanIdEqualTo(planId);
+        Plan updatePlan = new Plan();
+        updatePlan.setIsDelete(1);
+        planMapper.updateByExampleSelective(updatePlan, planExample);
 
+        PlanAccountExample planAccountExample = new PlanAccountExample();
+        planAccountExample.createCriteria().andPlanIdEqualTo(planId).andCreateTimeGreaterThan(DateUtil.getThatDayDate());
+        PlanAccount updatePlanAccount = new PlanAccount();
+        updatePlanAccount.setIsDelete(1);
+        planAccountMapper.updateByExampleSelective(updatePlanAccount, planAccountExample);
     }