| 
					
				 | 
			
			
				@@ -22,25 +22,29 @@ import kd.bos.servicehelper.operation.SaveServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.bos.servicehelper.user.UserServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import kd.hr.hbp.business.openservicehelper.hrpi.HRPIDepempServiceHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.base.common.constant.FormConstant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import nckd.jxccl.base.common.enums.PerfPlanRoleEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.base.common.schedule.ProgressCallback; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.base.common.utils.ConvertUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.base.common.utils.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.base.common.utils.StrFormatter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import nckd.jxccl.base.entity.helper.EntityHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.base.org.helper.AdminOrgHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.base.org.helper.PersonHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.base.orm.helper.QFilterCommonHelper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import nckd.jxccl.hr.hstu.common.HonorStudentConstant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Collections; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.HashSet; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Set; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.StringJoiner; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * 【优秀生】-生成评价问卷服务类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 【优秀生】-生成评价问卷服务类(生成优秀生评价预计打分人员核心逻辑) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @author W.Y.C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @date 2025/7/2 16:41 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @version 1.0 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -49,17 +53,20 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static final Log logger = LogFactory.getLog(CreateEvalQuestService.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 最大递归层级 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static final int MAX_RECURSION_DEPTH = 10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 批量生成评价问卷 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param evalQuestTplId 评价问卷模板Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param selectedEvalRule 评价问卷模板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param selectedEvalRule 评价规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param selectedPerson 被评价人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return: void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @author W.Y.C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @date: 2025/07/02 17:24 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public static void batchGenerateEvalQuest(Long evalQuestTplId, DynamicObject selectedEvalRule, DynamicObjectCollection selectedPerson, ProgressCallback callback, Long userId,Long orgId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        logger.info("【优秀生考评】-生成综合评测问卷-开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static void batchGenerateEvalQuest(DynamicObject evalQuestTpl, DynamicObject selectedEvalRule, DynamicObjectCollection selectedPerson, ProgressCallback callback, Long userId,Long orgId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        logger.info("【优秀生考评】-生成综合评测问卷开始,参数: evalQuestTplId={},selectedEvalRule={} ,selectedPersonSize={}", evalQuestTpl.getLong(FormConstant.ID_KEY), selectedEvalRule.getLong(FormConstant.ID_KEY),selectedPerson.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 获取当前用户ID和主组织ID(创建组织) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Long currUserId = userId; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -70,7 +77,7 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(currOrgId == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 currOrgId = RequestContext.get().getOrgId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //当前登录用户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DynamicObject currUser = UserServiceHelper.getUserInfoByID(currUserId, HonorStudentConstant.ID_KEY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 获取实体元数据 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -88,10 +95,9 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //单据页面操作 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //option.setVariableValue(OperateOptionConst.ISFORMVIEWOPERATION, Boolean.TRUE.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            DynamicObject evalQuestTpl = QueryServiceHelper.queryOne(HonorStudentConstant.NCKD_EVALQUESTTPL, "id",new QFilter[]{QFilterCommonHelper.getIdEqFilter(evalQuestTplId)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (evalQuestTpl == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                throw new KDBizException("评价问卷模板未找到"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //查询模板 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            evalQuestTpl = BusinessDataServiceHelper.loadSingle(evalQuestTpl.getLong(HonorStudentConstant.ID_KEY),HonorStudentConstant.NCKD_EVALQUESTTPL_ENTITYID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             StringJoiner ruleColum = new StringJoiner(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ruleColum.add(FormConstant.ID_KEY); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -101,7 +107,8 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ruleColum.add(HonorStudentConstant.NCKD_UPPER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //同级评分人下限人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ruleColum.add(HonorStudentConstant.NCKD_LOWER); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            selectedEvalRule = QueryServiceHelper.queryOne(HonorStudentConstant.EVALUATIONRULE_ENTITYID, ruleColum.toString(), new QFilter[]{QFilterCommonHelper.getIdEqFilter(selectedEvalRule.getLong(HonorStudentConstant.ID_KEY))}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //查询评价规则 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            selectedEvalRule = BusinessDataServiceHelper.loadSingle(selectedEvalRule.getLong(HonorStudentConstant.ID_KEY),HonorStudentConstant.EVALUATIONRULE_ENTITYID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (selectedEvalRule == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 throw new KDBizException("评价规则未找到"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -130,7 +137,7 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     //获取页面选择的多选基础数据可能会被存放在fbasedataid中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     DynamicObject depEmpRow = (DynamicObject)row.getDynamicObject(FormConstant.BASEDATAID_KEY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (depEmpRow == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        logger.warn("跳过无效的人员数据,索引:{}", i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        logger.warn("【优秀生考评】-跳过无效的人员数据,索引:{}", i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     personId = ConvertUtil.toLong(depEmpRow.getPkValue()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -141,20 +148,20 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (personId == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.warn("跳过人员ID为空的数据,索引:{}", i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.warn("【优秀生考评】-跳过人员ID为空的数据,索引:{}", i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                MainEntityType depempEntityType = EntityMetadataCache.getDataEntityType(PersonHelper.DEP_EMP_ENTITY_ID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DynamicObject person = new DynamicObject(depempEntityType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MainEntityType depEmpEntityType = EntityMetadataCache.getDataEntityType(PersonHelper.DEP_EMP_ENTITY_ID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObject person = new DynamicObject(depEmpEntityType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 person.set(FormConstant.ID_KEY,personId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //表头构建 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DynamicObject mainObj = prepareMainObject(person, org, currUser, selectedEvalRule, evalQuestTplId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObject mainObj = prepareMainObject(person, org, currUser, selectedEvalRule, evalQuestTpl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 //分录构建 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 DynamicObjectCollection entryEntity = fetchExpectedScorers(row, proportion, upper, lower, otherLower, Boolean.TRUE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (entryEntity == null || entryEntity.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.warn("未能获取到有效的评分人列表,人员ID:{}", personId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    logger.warn("【优秀生考评】-未能获取到有效的评分人列表,人员ID:{}", personId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 mainObj.set(HonorStudentConstant.NCKD_EVALQUESTENTRY,entryEntity); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -176,8 +183,17 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         logger.info("【优秀生考评】-生成综合评测问卷-结束"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 保存问卷 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param mainObj 主单 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param option 操作选项 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param personName 评价对象名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return: void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @author W.Y.C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @date: 2025/07/15 16:06 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static void saveQuest(DynamicObject mainObj, OperateOption option, String personName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        OperationResult operationResult = SaveServiceHelper.saveOperate(FormConstant.SAVE_KEY,HonorStudentConstant.NCKD_EVALQUEST, new DynamicObject[]{mainObj}, option); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OperationResult operationResult = SaveServiceHelper.saveOperate(FormConstant.SAVE_KEY,HonorStudentConstant.NCKD_EVALQUEST_ENTITYID, new DynamicObject[]{mainObj}, option); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!operationResult.isSuccess()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             StringJoiner errorMsg = new StringJoiner(";"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (IOperateInfo error : operationResult.getAllErrorOrValidateInfo()) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -194,23 +210,17 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param org 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param currUser 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param selectedEvalRule 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param evalQuestTplId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param evalQuestTpl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return: kd.bos.dataentity.entity.DynamicObject 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @author W.Y.C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @date: 2025/07/14 09:44 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private static DynamicObject prepareMainObject(DynamicObject person, DynamicObject org, DynamicObject currUser, DynamicObject selectedEvalRule, Long evalQuestTplId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        DynamicObject mainObj = BusinessDataServiceHelper.newDynamicObject(HonorStudentConstant.NCKD_EVALQUEST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static DynamicObject prepareMainObject(DynamicObject person, DynamicObject org, DynamicObject currUser, DynamicObject selectedEvalRule, DynamicObject evalQuestTpl) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject mainObj = EntityHelper.newAvailableBasicEntity(HonorStudentConstant.NCKD_EVALQUEST_ENTITYID,org,currUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         mainObj.set(HonorStudentConstant.NCKD_EVALPERSON, person); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.NCKD_PERIODSTATE, 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.NCKD_EVALUATIONRULE, selectedEvalRule.getLong(HonorStudentConstant.ID_KEY)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.NCKD_EVALQUESTTPL, evalQuestTplId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.CREATEORG_KEY, org); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.USEORG_KEY, org); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.CREATE_TIME_KEY, new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.CREATOR_KEY, currUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.STATUS, StatusEnum.C.toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        mainObj.set(HonorStudentConstant.ENABLE, EnableEnum.YES.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mainObj.set(HonorStudentConstant.NCKD_PERIODSTATE, "0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mainObj.set(HonorStudentConstant.NCKD_EVALUATIONRULE, selectedEvalRule); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        mainObj.set(HonorStudentConstant.NCKD_EVALQUESTTPL, evalQuestTpl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return mainObj; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -227,12 +237,29 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @date: 2025/07/10 17:38 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static DynamicObjectCollection fetchExpectedScorers(DynamicObject person,int proportion,int upper,int lower,int otherLower,boolean isLeadAndSuperior) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return fetchExpectedScorers(person, null,null, proportion, upper, lower, otherLower, isLeadAndSuperior); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 获取预计参与问卷打分的用户列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param person 评分人员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param adminColl 需要圈定的组织范围 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param excludePersonList 需要排除的人员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param proportion 其他同级评分人比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param upper 同级评分人上限人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param lower 同级评分人下限人数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param otherLower 根据比例计算出的其他部门同级评分人的最小人数(同级评分人下限人数*其他同级评分人比例/100=其他同级评分人下限人数) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param isLeadAndSuperior 是否获取上级和领导 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return: void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @author W.Y.C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @date: 2025/07/10 17:38 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public static DynamicObjectCollection fetchExpectedScorers(DynamicObject person,DynamicObjectCollection adminColl,List<Long> excludePersonList,int proportion,int upper,int lower,int otherLower,boolean isLeadAndSuperior) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long personId = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(person.containsProperty(FormConstant.BASEDATAID_KEY)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //获取页面选择的数据可能会被存放在fbasedataid中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DynamicObject depEmpRow = (DynamicObject)person.getDynamicObject(FormConstant.BASEDATAID_KEY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (depEmpRow == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                logger.warn("获取人员信息失败,BASEDATAID_KEY为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.warn("【优秀生考评】-获取人员信息失败,BASEDATAID_KEY为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 return new DynamicObjectCollection(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             personId = ConvertUtil.toLong(depEmpRow.getPkValue()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -241,13 +268,13 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (personId == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.warn("人员ID为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.warn("【优秀生考评】-人员ID为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return new DynamicObjectCollection(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Map<String, Object> depEmp = HRPIDepempServiceHelper.getDepemp(personId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (depEmp == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.warn("获取人员信息失败,人员ID:{}", personId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.warn("【优秀生考评】-获取人员信息失败,人员ID:{}", personId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return new DynamicObjectCollection(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -264,14 +291,24 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DynamicObject parentParentPosition = QueryServiceHelper.queryOne("hbpm_positionhr", "parent.parent.id as parentId", new QFilter[]{QFilterCommonHelper.getIdEqFilter(positionId)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (parentParentPosition != null && parentParentPosition.getLong("parentId") != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 QFilter positionFilter = new QFilter("position.id", QCP.equals, parentParentPosition.getLong("parentId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                leadColl = PersonHelper.getDepEmpEffectivePerson("id,person.name", positionFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObjectCollection leadTempColl = PersonHelper.getDepEmpEffectivePerson("id,person.name", positionFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Collections.shuffle(leadTempColl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(!leadTempColl.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DynamicObject lead = leadTempColl.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    leadColl.add(lead); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //2:获取上级(获取上级岗位中的人员作为上级) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DynamicObject parentPosition = QueryServiceHelper.queryOne("hbpm_positionhr", "parent.id as parentId", new QFilter[]{QFilterCommonHelper.getIdEqFilter(positionId)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (parentPosition != null && parentPosition.getLong("parentId") != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 QFilter positionFilter = new QFilter("position.id", QCP.equals, parentPosition.getLong("parentId")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                superiorColl = PersonHelper.getDepEmpEffectivePerson("id,person.name", positionFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObjectCollection superiorTempColl = PersonHelper.getDepEmpEffectivePerson("id,person.name", positionFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Collections.shuffle(superiorTempColl); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if(!superiorTempColl.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    DynamicObject superior = superiorTempColl.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    superiorColl.add(superior); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -292,12 +329,25 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //3:查询当前组织内的同级员工 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Set<Long> excludePersons = new HashSet<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(excludePersonList != null && !excludePersonList.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            excludePersons.addAll(excludePersonList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         excludePersons.add(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(isLeadAndSuperior) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             leadColl.forEach(dynamicObject -> excludePersons.add(dynamicObject.getLong(HonorStudentConstant.ID_KEY))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             superiorColl.forEach(dynamicObject -> excludePersons.add(dynamicObject.getLong(HonorStudentConstant.ID_KEY))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        DynamicObjectCollection peers = getPeers(adminOrgId,excludePersons, proportion,upper, lower, otherLower); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //如果有选择组织范围则查询组织范围内的人员,否则使用评价对象的组织 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> adminOrgIds = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(adminColl != null && !adminColl.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            adminColl.forEach(map ->{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObject baseData = map.getDynamicObject(HonorStudentConstant.BASEDATAID_KEY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                adminOrgIds.add(baseData.getLong(HonorStudentConstant.ID_KEY)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            adminOrgIds.add(adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObjectCollection peers = getPeers(adminOrgIds,excludePersons, proportion,upper, lower, otherLower); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         peers.forEach(dynamicObject -> excludePersons.add(dynamicObject.getLong(HonorStudentConstant.ID_KEY))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //4:同级其他部门在职人员 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -308,22 +358,20 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 主单据创建 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        DynamicObject mainObj = BusinessDataServiceHelper.newDynamicObject(HonorStudentConstant.NCKD_EVALQUEST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject mainObj = BusinessDataServiceHelper.newDynamicObject(HonorStudentConstant.NCKD_EVALQUEST_ENTITYID); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //分录创建 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         DynamicObjectCollection entryEntity = mainObj.getDynamicObjectCollection(HonorStudentConstant.NCKD_EVALQUESTENTRY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ////1:领导、2:上级、3:同级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(isLeadAndSuperior) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            builderEvalQuestEntry(leadColl, "1", entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            builderEvalQuestEntry(superiorColl, "2", entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            builderEvalQuestEntry(leadColl, PerfPlanRoleEnum.LEAD, entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            builderEvalQuestEntry(superiorColl, PerfPlanRoleEnum.SUPERIOR, entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        builderEvalQuestEntry(peers, "3", entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        builderEvalQuestEntry(otherPeers, "3", entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        builderEvalQuestEntry(peers, PerfPlanRoleEnum.PEERS, entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        builderEvalQuestEntry(otherPeers, PerfPlanRoleEnum.OTHER_PEERS, entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return entryEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private static final int MAX_RECURSION_DEPTH = 10; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 获取同级人员 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -331,13 +379,13 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      *  2.工作性质大类过滤掉编码为H01(居休)、H02(退养)、H03(随任)、H04(女工长假)、H05(长期工伤病休)、H06(长期病休)、H07(其他不在岗)、J(外派)的员工,不做为同级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      *  3.除去领导和上级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      *  4.入职超半年、职位非协理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param adminOrgId 当前组织ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param adminOrgIds 当前组织ID或自定义选择的组织 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param excludePersons 排除的ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return: kd.bos.dataentity.entity.DynamicObjectCollection 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @author W.Y.C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @date: 2025/07/08 17:48 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private static DynamicObjectCollection getPeers(Long adminOrgId,Set<Long> excludePersons,int proportion,int upper,int lower,int otherLower){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static DynamicObjectCollection getPeers(List<Long> adminOrgIds,Set<Long> excludePersons,int proportion,int upper,int lower,int otherLower){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //最终的结果 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         DynamicObjectCollection finalResult = new DynamicObjectCollection(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -346,14 +394,18 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //------ 基本条件 end------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //1.查询当前组织内的同级员工 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        QFilter adminOrgFilter = new QFilter("adminorg.id", QCP.equals, adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        QFilter adminOrgFilter = new QFilter("adminorg.id", QCP.in, adminOrgIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         DynamicObjectCollection depEmpEffectivePerson = PersonHelper.getDepEmpEffectivePerson("id,person.name", baseFilter, adminOrgFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        depEmpEffectivePerson.forEach(dynamicObject -> excludePersons.add(dynamicObject.getLong("id"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //2.当前组织人数小于下限人数,继续向上级组织查找直到 >= lower 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(depEmpEffectivePerson.size() < lower){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Integer count = recursionGetPeers(adminOrgId, depEmpEffectivePerson, baseFilter, lower, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.info("【优秀生考评】-向上级组织查找次数:{}",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (Long adminOrgId : adminOrgIds) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(depEmpEffectivePerson.size() < lower){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Integer count = recursionGetPeers(adminOrgId, depEmpEffectivePerson, baseFilter, lower, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                depEmpEffectivePerson.forEach(dynamicObject -> excludePersons.add(dynamicObject.getLong("id"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.info("【优秀生考评】-向上级组织查找次数:{}",count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //打乱顺序随机抽取前 upper 个 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Collections.shuffle(depEmpEffectivePerson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         int endIndex = Math.min(depEmpEffectivePerson.size(), upper); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -381,8 +433,12 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //------ 基本条件 end------ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long parentOrg = AdminOrgHelper.getParentOrg(adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         QFilter adminOrgFilter = new QFilter("adminorg.parent.id", QCP.equals, parentOrg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //排除自己部门下的人员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         adminOrgFilter.and(new QFilter("adminorg.id", QCP.not_equals, adminOrgId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         DynamicObjectCollection depEmpEffectivePerson = PersonHelper.getDepEmpEffectivePerson("id,person.name,adminorg.name", baseFilter, adminOrgFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        depEmpEffectivePerson.forEach(dynamicObject -> excludePersons.add(dynamicObject.getLong("id"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //2.当前组织人数小于下限人数,继续向上级组织查找直到 >= lower 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(depEmpEffectivePerson.size() < otherLower){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Integer count = recursionGetParentPeers(parentOrg, depEmpEffectivePerson, baseFilter, otherLower, 1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             logger.info("【优秀生考评】-向上级组织查找次数:{}",count); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -407,24 +463,25 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static Integer recursionGetPeers(Long adminOrgId,DynamicObjectCollection persons,QFilter baseFilter,int lower,Integer count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(count > MAX_RECURSION_DEPTH) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.warn("达到最大递归深度{}, 组织ID: {}", MAX_RECURSION_DEPTH, adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.warn("【优秀生考评】-达到最大递归深度:{}。结束递归, 组织ID: {}", MAX_RECURSION_DEPTH, adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long parentOrg = AdminOrgHelper.getParentOrg(adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(parentOrg == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.warn("【优秀生考评】-达到最大递归深度或组织为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 创建一个查询条件,用于筛选属于上级组织的人员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         QFilter adminOrgFilter = new QFilter("adminorg.id", QCP.equals, parentOrg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         DynamicObjectCollection depEmpEffectivePerson = PersonHelper.getDepEmpEffectivePerson("id,person.name,adminorg.name", baseFilter, adminOrgFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         persons.addAll(depEmpEffectivePerson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(persons.size() >= lower || count > MAX_RECURSION_DEPTH){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(persons.size() >= lower){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             count++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(count == MAX_RECURSION_DEPTH) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                logger.warn("即将达到最大递归深度, 组织ID: {}", adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.warn("【优秀生考评】-即将达到最大递归深度, 组织ID: {}", adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return recursionGetPeers(parentOrg,persons,baseFilter,lower,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -447,24 +504,25 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private static Integer recursionGetParentPeers(Long adminOrgId,DynamicObjectCollection persons,QFilter baseFilter,int lower,Integer count){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(count > MAX_RECURSION_DEPTH) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            logger.warn("达到最大递归深度{}, 组织ID: {}", MAX_RECURSION_DEPTH, adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.warn("【优秀生考评】-达到最大递归深度:{}。结束递归, 组织ID: {}", MAX_RECURSION_DEPTH, adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long parentOrg = AdminOrgHelper.getParentOrg(adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(parentOrg == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            logger.warn("【优秀生考评】-达到最大递归深度或组织为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 构建用于筛选上级管理组织下有效人员的过滤条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         QFilter adminOrgFilter = new QFilter("adminorg.parent.id", QCP.equals, parentOrg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         DynamicObjectCollection depEmpEffectivePerson = PersonHelper.getDepEmpEffectivePerson("id,person.name,adminorg.name", baseFilter, adminOrgFilter); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         persons.addAll(depEmpEffectivePerson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if(persons.size() >= lower || count > MAX_RECURSION_DEPTH){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(persons.size() >= lower){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return count; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             count++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if(count == MAX_RECURSION_DEPTH) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                logger.warn("即将达到最大递归深度, 组织ID: {}", adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.warn("【优秀生考评】-即将达到最大递归深度, 组织ID: {}", adminOrgId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return recursionGetParentPeers(parentOrg,persons,baseFilter,lower,count); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -479,23 +537,59 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @author W.Y.C 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @date: 2025/07/13 18:52 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private static void builderEvalQuestEntry(DynamicObjectCollection persons,String perfPlanRole,DynamicObjectCollection entryEntity){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static void builderEvalQuestEntry(DynamicObjectCollection persons,PerfPlanRoleEnum perfPlanRole,DynamicObjectCollection entryEntity){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Long> personIds = new ArrayList<>(persons.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        persons.forEach(person -> personIds.add(person.getLong(HonorStudentConstant.ID_KEY))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取任职经历 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Map<String, Object>> empOrgRelList = HRPIDepempServiceHelper.listEmpOrgrels(personIds); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //根据ID分组,获取所属公司和职位 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Long, Map<String, DynamicObject>> empOrgRelMap = empOrgRelList.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .filter(item -> item.get(FormConstant.DEP_EMP) != null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .collect(Collectors.toMap( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item -> ConvertUtil.toLong(item.get(FormConstant.DEP_EMP)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        item -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Map<String, DynamicObject> innerMap = new HashMap<>(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Long companyId = ConvertUtil.toLong(item.get("company")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if(companyId != null && companyId > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                DynamicObject company = BusinessDataServiceHelper.loadSingle(companyId, "haos_adminorghr"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                innerMap.put("company", company); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Long jobId = ConvertUtil.toLong(item.get("job")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            if(jobId != null && jobId > 0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                DynamicObject job = BusinessDataServiceHelper.loadSingle(jobId, "hbjm_jobhr"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                innerMap.put("job", job); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            return innerMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        (existing, replacement) -> replacement 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                )); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取人员对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DynamicObject[] dbPersons = BusinessDataServiceHelper.load(PersonHelper.DEP_EMP_ENTITY_ID, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                "id,person.id,person.name,person.number,adminorg.number,adminorg.name,position.name,position.number", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                new QFilter[]{new QFilter(FormConstant.ID_KEY, QCP.in, personIds)}); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Map<Long, DynamicObject> personMap = new HashMap<>(dbPersons.length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        for (DynamicObject obj : dbPersons) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            personMap.put(obj.getLong(FormConstant.ID_KEY), obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         persons.forEach(dynamicObject -> { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             DynamicObject evalQuest = entryEntity.addNew(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             long depEmpId = dynamicObject.getLong(HonorStudentConstant.ID_KEY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            evalQuest.set(HonorStudentConstant.NCKD_PERSON, depEmpId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            evalQuest.set(HonorStudentConstant.NCKD_PERFPLANROLE, perfPlanRole); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            DynamicObject person = personMap.get(depEmpId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            evalQuest.set(HonorStudentConstant.NCKD_PERSON, person); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            evalQuest.set(HonorStudentConstant.NCKD_PERFPLANROLE, perfPlanRole.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //获取任职经历 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<String, Object> empOrgRel = HRPIDepempServiceHelper.getDataEmpOrgrel(depEmpId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Long companyId = ConvertUtil.toLong(empOrgRel.get("company_id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Long jobId = ConvertUtil.toLong(empOrgRel.get("job_id")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            evalQuest.set(HonorStudentConstant.NCKD_COMPANY, companyId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            evalQuest.set(HonorStudentConstant.NCKD_JOB, jobId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, DynamicObject> empOrgRel = empOrgRelMap.get(depEmpId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            evalQuest.set(HonorStudentConstant.NCKD_COMPANY, empOrgRel.get("company")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            evalQuest.set(HonorStudentConstant.NCKD_JOB, empOrgRel.get("job")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //备注生成人员对应的角色 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            evalQuest.set(HonorStudentConstant.NCKD_REMARK, StrFormatter.format("系统生成:{}",perfPlanRole.getName())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * 查询人员基本条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 查询人员打分人员基本条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param excludePersons 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return: kd.bos.orm.query.QFilter 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @author W.Y.C 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -507,6 +601,7 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         baseFilter.and(new QFilter("startdate",QCP.less_equals, DateUtil.minusMonths(DateUtil.now(),6))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //职位非协理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         baseFilter.and(new QFilter("position.name", QCP.not_like, "%协理员%")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // TODO 1.最新一条党政职务履历为副处级及以上人员不作为同级取数 2.工作性质大类过滤掉编码为H01(居休)、H02(退养)、H03(随任)、H04(女工长假)、H05(长期工伤病休)、H06(长期病休)、H07(其他不在岗)、J(外派)的员工,不做为同级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return baseFilter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |