Forráskód Böngészése

修复履职一系列bug

luojun 2 éve
szülő
commit
320f843710

+ 6 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java

@@ -474,7 +474,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         /**
          * 验证计划是否被应用
          */
-        Long num = resumptionMapper.selectCount(new QueryWrapper<Resumption>().eq("plan_id", id));
+        Long num = resumptionMapper.selectCount(new QueryWrapper<Resumption>().eq("plan_id", id).eq("status",3));
         if (num > 0) {
             throw new RuntimeException("计划已生成任务,不能删除!");
         }
@@ -484,10 +484,12 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         //删除子计划
         for (AppPlan ap :
                 childrens) {
-            Long nums = resumptionMapper.selectCount(new QueryWrapper<Resumption>().eq("plan_id", ap.getId()));
+            Long nums = resumptionMapper.selectCount(new QueryWrapper<Resumption>().eq("plan_id", ap.getId()).eq("status",3));
             if (nums > 0) {
                 throw new RuntimeException("子计划已生成任务,不能删除!");
             }
+            //删除计划对应的任务
+            resumptionMapper.delete(new QueryWrapper<Resumption>().eq("plan_id", ap.getId()));
             //删除对应的角色关系
             QueryWrapper<AppPlanToRole> qw = new QueryWrapper<>();
             qw.lambda().eq(AppPlanToRole::getPlanId, ap.getId());
@@ -508,7 +510,8 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 
         }
 
-
+        //删除计划对应的任务
+        resumptionMapper.delete(new QueryWrapper<Resumption>().eq("plan_id", id));
         //删除对应的角色关系
         QueryWrapper<AppPlanToRole> qw = new QueryWrapper<>();
         qw.lambda().eq(AppPlanToRole::getPlanId, id);