| 
					
				 | 
			
			
				@@ -30,6 +30,8 @@ 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.HashSet; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -57,14 +59,7 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @date: 2025/07/02 17:24 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static void batchGenerateEvalQuest(Long evalQuestTplId, DynamicObject selectedEvalRule, DynamicObjectCollection selectedPerson, ProgressCallback callback, Long userId,Long orgId) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //同级人员取数条件: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //1.最新一条党政职务履历为副处级及以上人员不作为同级取数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //2.工作性质大类过滤掉编码为H01(居休)、H02(退养)、H03(随任)、H04(女工长假)、H05(长期工伤病休)、H06(长期病休)、H07(其他不在岗)、J(外派)的员工,不做为同级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //3.除去领导和上级 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //4.入职超半年、职位非协理员 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         logger.info("【优秀生考评】-生成综合评测问卷-开始"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 获取当前用户ID和主组织ID(创建组织) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Long currUserId = userId; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -126,6 +121,7 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //根据比例计算出的其他部门同级评分人的最小人数(同级评分人下限人数*其他同级评分人比例/100=其他同级评分人下限人数) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             int otherLower = (lower * proportion) / 100; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<DynamicObject> evalQuestList = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (int i = 0; i < selectedPerson.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 DynamicObject row = selectedPerson.get(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Long personId = null; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -153,40 +149,19 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 DynamicObject person = new DynamicObject(depempEntityType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 person.set(FormConstant.ID_KEY,personId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                // 主单据创建 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                DynamicObject mainObj = BusinessDataServiceHelper.newDynamicObject(HonorStudentConstant.NCKD_EVALQUEST); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //当表单是必填时必须要传结构对象,非必填的只传id就行 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //表头构建 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                DynamicObject mainObj = prepareMainObject(person, org, currUser, selectedEvalRule, evalQuestTplId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //分录构建 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 DynamicObjectCollection entryEntity = fetchExpectedScorers(row, proportion, upper, lower, otherLower, Boolean.TRUE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (entryEntity == null || entryEntity.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     logger.warn("未能获取到有效的评分人列表,人员ID:{}", personId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 mainObj.set(HonorStudentConstant.NCKD_EVALQUESTENTRY,entryEntity); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                OperationResult operationResult = SaveServiceHelper.saveOperate(FormConstant.SAVE_KEY,HonorStudentConstant.NCKD_EVALQUEST, new DynamicObject[]{mainObj}, option); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (!operationResult.isSuccess()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    StringJoiner errorMsg = new StringJoiner(";"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (IOperateInfo error : operationResult.getAllErrorOrValidateInfo()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        errorMsg.add(error.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        logger.error("【优秀生考评】-评价对象【{}】生成综合评测问卷-异常,异常信息:{}",personName,error.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    throw new KDBizException(StrFormatter.format("评价对象【{}】生成综合评测问卷失败,原因:{}",personName,errorMsg.toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                //保存 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                saveQuest(mainObj, option, personName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if(callback != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    //回调进度控件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     callback.onProgress(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -201,6 +176,44 @@ public class CreateEvalQuestService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         logger.info("【优秀生考评】-生成综合评测问卷-结束"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private static void saveQuest(DynamicObject mainObj, OperateOption option, String personName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        OperationResult operationResult = SaveServiceHelper.saveOperate(FormConstant.SAVE_KEY,HonorStudentConstant.NCKD_EVALQUEST, new DynamicObject[]{mainObj}, option); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!operationResult.isSuccess()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            StringJoiner errorMsg = new StringJoiner(";"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (IOperateInfo error : operationResult.getAllErrorOrValidateInfo()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                errorMsg.add(error.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.error("【优秀生考评】-评价对象【{}】生成综合评测问卷-异常,异常信息:{}", personName,error.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw new KDBizException(StrFormatter.format("评价对象【{}】生成综合评测问卷失败,原因:{}", personName,errorMsg.toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 构建表头 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param person 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param org 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param currUser 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param selectedEvalRule 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param evalQuestTplId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @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); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return mainObj; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 获取预计参与问卷打分的用户列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param person 评分人员 
			 |