|
|
@@ -895,28 +895,74 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
|
|
|
|
|
|
OrgTypeEnum orgTypeEnum = OrgTypeEnum.getOrgTypeEnum(typeList.get(0));
|
|
|
|
|
|
- // 省联社创建的计划
|
|
|
- if (checkIsParentPlan(trainingPlan.getId())) {
|
|
|
- List<CoreEduTrainingPlan> allHsPlanList = getHsPlanList(trainingPlan);
|
|
|
- if (ObjectUtil.isEmpty(allHsPlanList)) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 此处缺失逻辑判断,如果时创建执行机构时行社的任务,不会生成子任务
|
|
|
+ * 会判断此类计划是行社自建,导致出错。
|
|
|
+ */
|
|
|
+ Long createOrgId = trainingPlan.getCreateOrgId();
|
|
|
+ SysOrg sysOrg = orgService.selectSysOrgById(createOrgId, SecurityConstants.INNER);
|
|
|
+ Integer orgType = sysOrg.getType();
|
|
|
+ if (ObjectUtil.equal(orgType, OrgTypeEnum.SHEGN_LIAN_SHE.getCode())) {
|
|
|
+ // 省联社创建的计划
|
|
|
+ if (checkIsParentPlan(trainingPlan.getId())) {
|
|
|
+ List<CoreEduTrainingPlan> allHsPlanList = getHsPlanList(trainingPlan);
|
|
|
+ if (ObjectUtil.isEmpty(allHsPlanList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String, Object> map = getHsOrg(orgCacheList, orgList, orgTypeEnum);
|
|
|
+ List<Long> hsOrgIdList = ((List<SysOrgVO>) map.get("list")).stream().map(SysOrgVO::getId).collect(toList());
|
|
|
+ List<Long> hsPlanIdList = allHsPlanList.stream().map(CoreEduTrainingPlan::getId).collect(toList());
|
|
|
+ if (ObjectUtil.hasEmpty(hsPlanIdList, hsOrgIdList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<CoreEduTrainingPlan> reallyPlanIdList = findReallyPlanIdList(hsPlanIdList, hsOrgIdList);
|
|
|
+ boolean underHsOrgType = (boolean) map.get("underHsOrgType");
|
|
|
+ for (CoreEduTrainingPlan plan : reallyPlanIdList) {
|
|
|
+ create(plan, underHsOrgType ? idList : null, threadPoolTaskExecutor);
|
|
|
+ }
|
|
|
+ compensateLogService.buildLog(getBusinessPlanType(), false, orgIdList, trainingPlan.getId(), trainingPlan.getPlanName(), errorMsg);
|
|
|
|
|
|
- Map<String, Object> map = getHsOrg(orgCacheList, orgList, orgTypeEnum);
|
|
|
- List<Long> hsPlanIdList = allHsPlanList.stream().map(CoreEduTrainingPlan::getId).collect(toList());
|
|
|
- List<Long> hsOrgIdList = ((List<SysOrgVO>) map.get("list")).stream().map(SysOrgVO::getId).collect(toList());
|
|
|
- if (ObjectUtil.hasEmpty(hsPlanIdList, hsOrgIdList)) {
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ Integer execOrgType = trainingPlan.getExecOrgType();
|
|
|
+ List<Long> orgIds = coreEduTrainingPlanToExecOrgMapper.selectOrgIdByPlanId(trainingPlan.getId());
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ if(ObjectUtil.isNotEmpty(orgIds)){
|
|
|
+ //该计划是指定了具体机构的计划
|
|
|
+ //获取机构在 orgList子集机构
|
|
|
+ for (SysOrgVO sysOrgVO : orgList) {
|
|
|
+ List<SysOrg> sysOrgs = orgService.selectByOrgPathAndOrgType(sysOrgVO.getPath(), execOrgType, SecurityConstants.INNER);
|
|
|
+ if(ObjectUtil.isNotEmpty(sysOrgs)){
|
|
|
+ //获取sysOrgs 的属性id集合
|
|
|
+ List<Long> cids = sysOrgs.stream().map(SysOrg::getId).collect(toList());
|
|
|
+ //求cids和orgIds之间的交集
|
|
|
+ List<Long> collect = cids.stream().filter(id -> orgIds.contains(id)).collect(toList());
|
|
|
+ if(!collect.isEmpty()){
|
|
|
+ ids.addAll(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //该计划是只指定了机构类型的计划
|
|
|
+ //获取orgList 机构树下的 机构类型
|
|
|
+ for (SysOrgVO sysOrgVO : orgList) {
|
|
|
+ List<SysOrg> sysOrgs = orgService.selectByOrgPathAndOrgType(sysOrgVO.getPath(), execOrgType, SecurityConstants.INNER);
|
|
|
+ if(ObjectUtil.isNotEmpty(sysOrgs)){
|
|
|
+ //获取sysOrgs 的属性id集合
|
|
|
+ ids.addAll(sysOrgs.stream().map(SysOrg::getId).collect(toList()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //没有子类计划的省联社计划
|
|
|
+ create(trainingPlan,ids,threadPoolTaskExecutor);
|
|
|
+ compensateLogService.buildLog(getBusinessPlanType(), false, orgIdList, trainingPlan.getId(), trainingPlan.getPlanName(), errorMsg);
|
|
|
return;
|
|
|
}
|
|
|
- List<CoreEduTrainingPlan> reallyPlanIdList = findReallyPlanIdList(hsPlanIdList, hsOrgIdList);
|
|
|
- boolean underHsOrgType = (boolean) map.get("underHsOrgType");
|
|
|
- for (CoreEduTrainingPlan plan : reallyPlanIdList) {
|
|
|
- create(plan, underHsOrgType ? idList : null, threadPoolTaskExecutor);
|
|
|
- }
|
|
|
- compensateLogService.buildLog(getBusinessPlanType(), false, orgIdList, trainingPlan.getId(), trainingPlan.getPlanName(), errorMsg);
|
|
|
|
|
|
- return;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 行社自建计划
|
|
|
if (INVALID_ORG_TYPES.contains(orgTypeEnum)) {
|
|
|
errorMsg = "orgIdList中传递机构信息错误!与计划信息不匹配";
|