luojun 2 éve
szülő
commit
513d06f5c1

+ 7 - 0
project_data/sql/0.0.2/soc/soc.sql

@@ -1068,6 +1068,13 @@ END IF;
 
     END IF;
 
+    -- 履职项所属机构id字段
+    IF
+        NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'core_resumption_plan_to_point' AND COLUMN_NAME = 'of_org_id' ) THEN
+        ALTER TABLE `core_resumption_plan_to_point` ADD COLUMN `of_org_id` bigint NULL COMMENT '所属机构id';
+
+    END IF;
+
     -- 履职计划所属机构类型
     IF
         NOT EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'core_resumption_plan' AND COLUMN_NAME = 'plan_of_org_type' ) THEN

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlanToPoint.java

@@ -40,4 +40,5 @@ public class AppPlanToPoint extends Model<AppPlanToPoint> implements Serializabl
      * 检查要点是否必须检查
      */
     private boolean required;
+    private Long ofOrgId;
 }

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

@@ -332,57 +332,21 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                 item.setPlanId(id);
                 item.setPointScan(ruleItemVo.isPointScan());
                 item.setRequired(ruleItemVo.isRequired());
+                item.setOfOrgId(ruleItemVo.getOfOrgId());
                 appPlanToItemMapper.insert(item);
             }
-
-
-//            Integer orgId = app.getExecOrgType();
-//            if (orgId != null) {
-//                AppPlanToCheckOrg checkOrg = new AppPlanToCheckOrg();
-//                AppPlanToExecOrg execOrg = new AppPlanToExecOrg();
-//                List<SysOrg> sysOrgs = orgService.selectByOrgType(orgId, SecurityConstants.INNER);
-//                List<Long> orgids = sysOrgs.stream().map(SysOrg::getId).collect(Collectors.toList());
-//                for (Long i :
-//                        orgids) {
-//                    checkOrg.setOrgId(i);
-//                    checkOrg.setPlanId(id);
-//                    execOrg.setOrgId(i);
-//                    execOrg.setPlanId(id);
-//                    appPlanToCheckOrgMapper.insert(checkOrg);
-//                    appPlanToExecOrgMapper.insert(execOrg);
-//                }
-//
-//
-//
-//            }
         } else {
             if (app.getRoleList() == null) {
                 app.setRoleList(new ArrayList<>());
             }
 
-//            //获取计划对应的已完成任务数量
-//            Long num = resumptionMapper.selectCount(new QueryWrapper<Resumption>().eq("plan_id", app.getId()).eq("status", 3));
-//            if (num > 0) {
-//                //如果状态为已禁用
-//                if (app.getPlanStatus() == 0) {
-//                    throw new RuntimeException("计划已生成任务,不能禁用!");
-//                }
-//
-//            }
-
             //修改所有子计划
             List<AppPlan> appPlans = baseMapper.selectList(new LambdaQueryWrapper<AppPlan>().eq(AppPlan::getParentId, plan.getId()));
             for (AppPlan ap :
                     appPlans) {
-//                Long nums = resumptionMapper.selectCount(new QueryWrapper<Resumption>().eq("plan_id", ap.getId()).eq("status", 3));
-//                if (nums > 0) {
-//                    if (app.getPlanStatus() == 0) {
-//                        throw new RuntimeException("计划已生成任务,不能禁用!");
-//                    }
-//                }
+
                 ap.setPlanType(plan.getPlanType());
                 ap.setPlanCycle(plan.getPlanCycle());
-//                ap.setPlanStatus(plan.getPlanStatus());
                 ap.setExecOrgType(plan.getExecOrgType());
                 ap.setPlanExec(plan.getPlanExec());
                 ap.setModifiedBy(SecurityUtils.getUserId());
@@ -397,7 +361,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                 }
 
                 QueryWrapper<AppPlanToPoint> api = new QueryWrapper<>();
-                api.lambda().eq(AppPlanToPoint::getPlanId, ap.getId());
+                api.lambda().eq(AppPlanToPoint::getPlanId, ap.getId()).eq(AppPlanToPoint::getOfOrgId,app.getPlanCreateOrgId());
                 appPlanToItemMapper.delete(api);
 
                 List<Long> roleList = app.getRoleList();
@@ -410,8 +374,10 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                 }
 
 
-                List<RuleItemVo> itemList = app.getItemList();
-                if (itemList.size() == 0) {
+                List<RuleItemVo> valitemList = app.getItemList();
+                List<RuleItemVo> itemList = valitemList.stream().filter(e-> e.getOfOrgId().equals(app.getPlanCreateOrgId())).collect(Collectors.toList());
+
+                if (valitemList.size() == 0) {
                     throw new RuntimeException("请选择履职要点");
                 }
                 AppPlanToPoint item = null;
@@ -421,6 +387,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                     item.setPlanId(ap.getId());
                     item.setPointScan(ruleItemVo.isPointScan());
                     item.setRequired(ruleItemVo.isRequired());
+                    item.setOfOrgId(ruleItemVo.getOfOrgId());
                     appPlanToItemMapper.insert(item);
                 }
                 //如果计划是编辑全部,代表不存在已完成或者逾期的任务,需要删除重新生成
@@ -444,7 +411,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 
 
             QueryWrapper<AppPlanToPoint> api = new QueryWrapper<>();
-            api.lambda().eq(AppPlanToPoint::getPlanId, id);
+            api.lambda().eq(AppPlanToPoint::getPlanId, id).eq(AppPlanToPoint::getOfOrgId,app.getPlanCreateOrgId());
             appPlanToItemMapper.delete(api);
 
 
@@ -463,8 +430,10 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                 appPlanToRoleMapper.insert(atr);
             }
 
-            List<RuleItemVo> itemList = app.getItemList();
-            if (itemList.size() == 0) {
+            List<RuleItemVo> valitemList = app.getItemList();
+            List<RuleItemVo> itemList = valitemList.stream().filter(e-> e.getOfOrgId().equals(app.getPlanCreateOrgId())).collect(Collectors.toList());
+
+            if (valitemList.size() == 0) {
                 throw new RuntimeException("请选择履职要点");
             }
             AppPlanToPoint item = null;
@@ -474,6 +443,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                 item.setPlanId(id);
                 item.setPointScan(ruleItemVo.isPointScan());
                 item.setRequired(ruleItemVo.isRequired());
+                item.setOfOrgId(ruleItemVo.getOfOrgId());
                 appPlanToItemMapper.insert(item);
             }
 

+ 4 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/appPlan/RuleItemVo.java

@@ -48,6 +48,10 @@ public class RuleItemVo {
      * 区域Id
      */
     private Long areaId;
+    /**
+     * 检查点所属机构id
+     */
+    private Long ofOrgId;
 
 
     /**

+ 2 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppPlanMapper.xml

@@ -219,6 +219,7 @@
 
     <select id="selectByPlanId" resultType="com.xunmei.core.resumption.vo.appPlan.RuleItemVo">
         SELECT h.point_id      as id,
+               h.of_org_id,
                a.item_id,
                b.NAME          AS item_name,
                b.DESC          AS item_desc,--                b.item_num,
@@ -229,7 +230,7 @@
                h.required,
                d.NAME          AS ruleName,
                a.business_type AS businessType
-        FROM (SELECT point_id, point_scan, required FROM core_resumption_plan_to_point WHERE plan_id = #{planId}) h
+        FROM (SELECT point_id, point_scan, required,of_org_id FROM core_resumption_plan_to_point WHERE plan_id = #{planId}) h
                  LEFT JOIN core_resumption_rule_point a ON h.point_id = a.id
                  LEFT JOIN core_resumption_rule_item b ON a.item_id = b.id
                  LEFT JOIN sys_area c ON a.area_id = c.id