Kaynağa Gözat

fix(annual-adjustment): 修复年度调整服务中的空指针异常

- 添加对 ac.data.getRankingResultInfo() 的空值检查以避免空指针异常
- 修复获取职级名称时可能发生的空指针异常,添加空值处理逻辑
- 修复上年度考核结果获取时的空指针异常,添加空值安全检查
- 修复获取工作积分信息时的空指针异常,添加空值验证逻辑
- 修复获取转换职位序列信息时的空指针异常,添加安全检查机制
wyc 1 gün önce
ebeveyn
işleme
c760fc322a

+ 6 - 6
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/business/AnnualAdjustmentService.java

@@ -153,7 +153,7 @@ public class AnnualAdjustmentService {
         }
 
         JobLevelCalculatorService.JobLevelResult jobLevelResult = JobLevelCalculatorService.calculateJobLevel(person, beginDate == null ? new Date() : beginDate, ac.positionAppointment);
-        if(jobLevelResult.rankingResultInfo != null) {
+        if(jobLevelResult.rankingResultInfo != null && ac.data.getRankingResultInfo() != null) {
             ac.data.getRankingResultInfo().allowanceRankMark = jobLevelResult.rankingResultInfo.allowanceRankMark;
             ac.data.getRankingResultInfo().allowanceRankSel = jobLevelResult.rankingResultInfo.allowanceRankSel;
         }
@@ -335,12 +335,12 @@ public class AnnualAdjustmentService {
             DynamicObject ocpQualLevel = lastPersonPosFile.getDynamicObject(PositionStructureConstant.NCKD_OCPQUALLEVEL);
             String jobStatusScore = lastPersonPosFile.getString(PositionStructureConstant.NCKD_JOBSTATUSSCORE);
             ac.whyAdjust1.add(StrFormatter.format("上一职位档案技能【{}】,技能等级【{}】,技能等级分【{}】", jobStatusName,ocpQualLevel == null ? "无" : ocpQualLevel.getString(FormConstant.NAME_KEY), jobStatusScore == null ? "无" : jobStatusScore));
-            ac.whyAdjust1.add(StrFormatter.format("上一职位档案职级【{}({})】", jobLevel.getString(FormConstant.NAME_KEY),data.getLastJobGradeIndex()));
+            ac.whyAdjust1.add(StrFormatter.format("上一职位档案职级【{}({})】", jobLevel != null ? jobLevel.getString(FormConstant.NAME_KEY) : "未知",data.getLastJobGradeIndex()));
             ac.whyAdjust1.add("----------------------------------------------------------");
             //---------------------------------- 调整日志 end ----------------------------------
         }
 
-        ac.whyAdjust1.add(StrFormatter.format("上年度【{}】考核结果为【{}】;", lastYear, performanceResult.getString(FormConstant.NAME_KEY)));
+        ac.whyAdjust1.add(StrFormatter.format("上年度【{}】考核结果为【{}】;", lastYear, performanceResult != null ? performanceResult.getString(FormConstant.NAME_KEY) : "未知"));
         if(rankingInfo == null) {
             ac.whyAdjust1.add("无全排名");
         }else{
@@ -607,8 +607,8 @@ public class AnnualAdjustmentService {
 
         ac.allSumScore = ac.sumScore
                 .add(ac.diplomaScore)
-                .add(ac.data.getJobScoreInfo().perProTitleScore)
-                .add(ac.data.getJobScoreInfo().quaLevelScore);
+                .add(ac.data.getJobScoreInfo() != null ? ac.data.getJobScoreInfo().perProTitleScore : BigDecimal.ZERO)
+                .add(ac.data.getJobScoreInfo() != null ? ac.data.getJobScoreInfo().quaLevelScore : BigDecimal.ZERO);
         logger.info("累计总积分: " + ac.allSumScore);
     }
 
@@ -625,7 +625,7 @@ public class AnnualAdjustmentService {
 
         //上一条职位档案的职位序列(如果是管理序列,则转换为职能序列)
         String newJobSeqNumber = ac.convertJobSeq.getString(FormConstant.NUMBER_KEY);
-        String newLastJobSeqNumber = ac.data.getConvertLastJobSeq().getString(FormConstant.NUMBER_KEY);
+        String newLastJobSeqNumber = ac.data.getConvertLastJobSeq() != null ? ac.data.getConvertLastJobSeq().getString(FormConstant.NUMBER_KEY) : "未知";
         if (!newJobSeqNumber.equalsIgnoreCase(newLastJobSeqNumber)) {
             //序列发生变化
             String errorMsg = StrFormatter.format("人员【{}】,序列发生变化!请先到【员工职位档案调整】中进行操作", ac.personName);