Преглед на файлове

fix(perf): 修正年度考核结果查询的年份计算逻辑

- 修正了考核结果查询时间范围的年份计算,从2年改为3年
- 更新了考核结果年份匹配逻辑,确保正确对应当前年份和历史年份
- 添加了职称和技能信息的查询字段
- 集成了职称/技能信息的去重合并功能
- 修正了组织架构查询的过滤条件,添加了岗位状态筛选
- 优化了数据集查询结果的字段映射和数据处理逻辑
wyc преди 1 седмица
родител
ревизия
17ea84339b

+ 8 - 8
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/task/KeyBeHavEvalTask.java

@@ -106,9 +106,9 @@ public class KeyBeHavEvalTask extends AbstractTask implements Plugin {
 
         //查询近3年考核结果
         logger.info("开始查询近3年考核结果");
-        int threeYearsAgo = LocalDate.now().minusYears(2).getYear();
+        int threeYearsAgo = LocalDate.now().minusYears(3).getYear();
         Date beginDate = DateUtil.toDate(LocalDate.of(threeYearsAgo, 1, 1));
-        int currentYear = LocalDate.now().getYear();
+        int currentYear = LocalDate.now().getYear()-1;
         Date endDate = DateUtil.endOfYear(DateUtil.toDate(LocalDate.of(currentYear, 1, 1)));
         logger.info("考核结果查询时间范围: {} 到 {}", DateUtil.getYear(beginDate), DateUtil.getYear(endDate));
         //查询最近3年的数据
@@ -168,22 +168,22 @@ public class KeyBeHavEvalTask extends AbstractTask implements Plugin {
                     String appraisalResultName = result.getString(String.join(".", PositionStructureConstant.NCKD_PERFMANAGERENTRY, PositionStructureConstant.NCKD_APPRAISALRESULT, FormConstant.NAME_KEY));
                     if(appraisalYear != null) {
                         int year = DateUtil.toLocalDateTime(appraisalYear).getYear();
-                        if (year == currentYear - 1) {
+                        if (year == currentYear) {
                             appraisalResultYear1 = appraisalResult;
                             appraisalResultYearName1 = StringUtils.isBlank(appraisalResultName) ? "无" : appraisalResultName;
-                        } else if (year == currentYear - 2) {
+                        } else if (year == currentYear - 1) {
                             appraisalResultYear2 = appraisalResult;
                             appraisalResultYearName2 = StringUtils.isBlank(appraisalResultName) ? "无" : appraisalResultName;
-                        } else if (year == currentYear - 3) {
+                        } else if (year == currentYear - 2) {
                             appraisalResultYear3 = appraisalResult;
                             appraisalResultYearName3 = StringUtils.isBlank(appraisalResultName) ? "无" : appraisalResultName;
                         }
                     }
                 }
                 logger.debug("员工ID {} 考核结果: 第一年({})={}, 第二年({})={}, 第三年({})={}", 
-                    personId, currentYear - 1, appraisalResultYearName1, 
-                    currentYear - 2, appraisalResultYearName2, 
-                    currentYear - 3, appraisalResultYearName3);
+                    personId, currentYear, appraisalResultYearName1,
+                    currentYear - 1, appraisalResultYearName2,
+                    currentYear - 2, appraisalResultYearName3);
             }
 
 

+ 30 - 8
code/opmc/nckd-jxccl-opmc/src/main/java/nckd/jxccl/opmc/pm/plugin/form/result/AnnualPerfDetailReportListDataPlugin.java

@@ -14,6 +14,7 @@ import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.hr.hbp.business.servicehelper.HRQueryEntityHelper;
 import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.common.algo.DistinctConcatFunction;
 import nckd.jxccl.base.common.constant.FormConstant;
 import nckd.jxccl.base.common.utils.DateUtil;
 import nckd.jxccl.base.common.utils.QueryFieldBuilder;
@@ -51,6 +52,7 @@ public class AnnualPerfDetailReportListDataPlugin extends AbstractReportListData
         /*QFilter qFilter = new QFilter(PerfManagerFormConstant.NCKD_BEGINYEAR, QCP.less_equals, endDate)
                 .and(new QFilter(PerfManagerFormConstant.NCKD_ENDYEAR, QCP.large_equals, beginDate));*/
         QFilter qFilter = QFilter.of("1=1");
+        qFilter.and(String.join(".", FormConstant.HRPI_EMPPOSORGREL, FormConstant.POS_STATUS,FormConstant.POST_STATE_CLS, FormConstant.NUMBER_KEY),QCP.equals,"1010_S");
 
         // 处理快速过滤条件
         processFastFilter(reportQueryParam, qFilter);
@@ -78,7 +80,7 @@ public class AnnualPerfDetailReportListDataPlugin extends AbstractReportListData
             );
             tempIndex++;
         }
-        withYearFields.print(true);
+
 
         // 按分组字段聚合
         GroupbyDataSet groupbyDataSet = withYearFields.groupBy(new String[]{
@@ -91,10 +93,15 @@ public class AnnualPerfDetailReportListDataPlugin extends AbstractReportListData
                 String.join(".", FormConstant.HRPI_EMPPOSORGREL, FormConstant.ADMINORG, FormConstant.NCKD_FOURTHORG, FormConstant.ID_KEY),
                 String.join(".", FormConstant.HRPI_EMPPOSORGREL, FormConstant.ADMINORG, FormConstant.NCKD_FIFTHORG, FormConstant.ID_KEY),
                 String.join(".", FormConstant.HRPI_EMPPOSORGREL, FormConstant.ADMINORG, FormConstant.NCKD_SIXTHORG, FormConstant.ID_KEY),
-                String.join(".", FormConstant.HRPI_EMPPOSORGREL, FormConstant.POS_STATUS, FormConstant.ID_KEY),
+                String.join(".", FormConstant.NCKD_PERSON, FormConstant.NCKD_JOINWORKTIME),
+                String.join(".", FormConstant.NCKD_PERSON, FormConstant.BIRTHDAY),
+                String.join(".", FormConstant.NCKD_PERSON, FormConstant.GENDER,FormConstant.NAME_KEY),
+                String.join(".", FormConstant.HRPI_PEREDUEXP, FormConstant.EDUCATION_KEY,FormConstant.NAME_KEY),
+
 //                String.join(".", FormConstant.NCKD_EMPPOSORGREL, FormConstant.POSITION_KEY, FormConstant.ID_KEY),
                 String.join(".", "last_perfmanager", PerfManagerFormConstant.NCKD_BEGINYEAR),
-                String.join(".", "last_perfmanager", PerfManagerFormConstant.NCKD_ENDYEAR)
+                String.join(".", "last_perfmanager", PerfManagerFormConstant.NCKD_ENDYEAR),
+                String.join(".", PerfManagerFormConstant.HRPI_EMPPOSORGREL, PerfManagerFormConstant.POSITION_KEY, FormConstant.ID_KEY),
         });
         int tempIndex1 = 1;
         for (int year = fiveYearsAgo; year <= currentYear; year++) {
@@ -102,10 +109,19 @@ public class AnnualPerfDetailReportListDataPlugin extends AbstractReportListData
                     .max("temp_"+tempIndex1, tempIndex1+"_result");
             tempIndex1++;
         }
-
+        //职称/技能使用逗号分拼接
+        groupbyDataSet.agg(new DistinctConcatFunction(),"hrpi_perprotitle.professional.name","perprotitlenames");
+        groupbyDataSet.agg(new DistinctConcatFunction(),"nckd_hrpi_empskill.nckd_qualiname","qualinames");
         DataSet result = groupbyDataSet.finish();
-        result.print( true);
-        return result;
+        // 创建新数组,长度比原数组多1
+        String[] mainTableFieldNames = result.getRowMeta().getFieldNames();
+        String[] newMainTableFieldNames = new String[mainTableFieldNames.length + 1];
+        System.arraycopy(mainTableFieldNames, 0, newMainTableFieldNames, 0, mainTableFieldNames.length);
+        // 在最后添加新字段
+        newMainTableFieldNames[mainTableFieldNames.length] = "REPLACE(REPLACE(REPLACE(concat(perprotitlenames,';',qualinames),'null,',''),'null;',''),'null','') as perprotitlOrQuali";
+        mainTableFieldNames = newMainTableFieldNames;
+
+        return   result.select(mainTableFieldNames);
     }
 
     @Override
@@ -151,17 +167,23 @@ public class AnnualPerfDetailReportListDataPlugin extends AbstractReportListData
                 .addGroup(new String[]{PerfManagerFormConstant.PERFMANAGERENTRY},PerfManagerFormConstant.ID_KEY)
                 .addGroup(new String[]{FormConstant.NCKD_EMPPOSORGREL,FormConstant.EMPLOYEE_KEY}, FormConstant.EMP_NUMBER_KEY, FormConstant.NAME_KEY)
                 .addIdNumberName(FormConstant.NCKD_PERSON)
-                .addIdNumberName(FormConstant.HRPI_EMPPOSORGREL,FormConstant.POS_STATUS)
+                .add(String.join(".", FormConstant.NCKD_PERSON, FormConstant.NCKD_JOINWORKTIME))
+                .add(String.join(".", FormConstant.NCKD_PERSON, FormConstant.BIRTHDAY))
+                .add(String.join(".", FormConstant.NCKD_PERSON, FormConstant.GENDER,FormConstant.NAME_KEY))
+                .add(String.join(".", FormConstant.HRPI_PEREDUEXP, FormConstant.EDUCATION_KEY,FormConstant.NAME_KEY))
                 .addIdNumberName(FormConstant.HRPI_EMPPOSORGREL,FormConstant.ADMINORG,FormConstant.NCKD_FIRSTORG)
                 .addIdNumberName(FormConstant.HRPI_EMPPOSORGREL,FormConstant.ADMINORG,FormConstant.NCKD_SECONDORG)
                 .addIdNumberName(FormConstant.HRPI_EMPPOSORGREL,FormConstant.ADMINORG,FormConstant.NCKD_THIRDORG)
                 .addIdNumberName(FormConstant.HRPI_EMPPOSORGREL,FormConstant.ADMINORG,FormConstant.NCKD_FOURTHORG)
                 .addIdNumberName(FormConstant.HRPI_EMPPOSORGREL,FormConstant.ADMINORG,FormConstant.NCKD_FIFTHORG)
                 .addIdNumberName(FormConstant.HRPI_EMPPOSORGREL,FormConstant.ADMINORG,FormConstant.NCKD_SIXTHORG)
+                .addIdNumberName( PerfManagerFormConstant.HRPI_EMPPOSORGREL, PerfManagerFormConstant.POSITION_KEY)
 //                .addIdNumberName(FormConstant.HRPI_EMPPOSORGREL,FormConstant.POSITION_KEY)
                 .addGroup(new String[]{"last_perfmanager"},
                         PerfManagerFormConstant.NCKD_BEGINYEAR,
-                        PerfManagerFormConstant.NCKD_ENDYEAR);
+                        PerfManagerFormConstant.NCKD_ENDYEAR)
+                .add(String.join(".", FormConstant.HRPI_PERPROTITLE, FormConstant.PROFESSIONAL_KEY,FormConstant.NAME_KEY))
+                .add(String.join(".", FormConstant.NCKD_HRPI_EMPSKILL, FormConstant.NCKD_QUALINAME));
 
     }