Jelajahi Sumber

调整履职修改父计划同步修改子计划

luojun 2 tahun lalu
induk
melakukan
e49ebe294a

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

@@ -309,6 +309,55 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 
             baseMapper.updateById(plan);
 
+
+            List<AppPlan> appPlans = baseMapper.selectList(new LambdaQueryWrapper<AppPlan>().eq(AppPlan::getParentId, plan.getId()));
+            for (AppPlan ap :
+                    appPlans) {
+                ap.setPlanName(plan.getPlanName());
+                ap.setPlanType(plan.getPlanType());
+                ap.setPlanCycle(plan.getPlanCycle());
+                ap.setPlanStatus(plan.getPlanStatus());
+                ap.setExecOrgType(plan.getExecOrgType());
+                ap.setPlanExec(plan.getPlanExec());
+                baseMapper.updateById(ap);
+
+                if (app.getRoleList().size() > 0) {
+                    QueryWrapper<AppPlanToRole> apr = new QueryWrapper<>();
+                    apr.lambda().eq(AppPlanToRole::getPlanId, ap.getId());
+                    appPlanToRoleMapper.delete(apr);
+                }
+
+                QueryWrapper<AppPlanToPoint> api = new QueryWrapper<>();
+                api.lambda().eq(AppPlanToPoint::getPlanId, ap.getId());
+                appPlanToItemMapper.delete(api);
+
+                List<Long> roleList = app.getRoleList();
+                AppPlanToRole atr = null;
+                for (Long roleId : roleList) {
+                    atr = new AppPlanToRole();
+                    atr.setRoleId(roleId);
+                    atr.setPlanId(ap.getId());
+                    appPlanToRoleMapper.insert(atr);
+                }
+
+
+                List<RuleItemVo> itemList = app.getItemList();
+                if (itemList.size() == 0) {
+                    throw new RuntimeException("请选择履职要点");
+                }
+                AppPlanToPoint item = null;
+                for (RuleItemVo ruleItemVo : itemList) {
+                    item = new AppPlanToPoint();
+                    item.setPointId(ruleItemVo.getId());
+                    item.setPlanId(ap.getId());
+                    item.setPointScan(ruleItemVo.isPointScan());
+                    item.setRequired(ruleItemVo.isRequired());
+                    appPlanToItemMapper.insert(item);
+                }
+
+
+            }
+
             Long id = plan.getId();
             if (app.getRoleList().size() > 0) {
                 QueryWrapper<AppPlanToRole> apr = new QueryWrapper<>();