Quellcode durchsuchen

feat(base): 添加Tab标签基础插件并修复年度调整服务中的空指针异常

- 新增TabBaseListPlugin类实现标签页关闭功能
- 在AnnualAdjustmentService中添加jobSeq空值检查避免空指针异常
- 修复ScoreItemEnum空值检查防止运行时错误
- 更新ContributionHelper中日志记录器为正确类名
- 在UnAdjustedReportFormPlugin中添加关闭按钮事件处理
wyc vor 1 Tag
Ursprung
Commit
d4783290eb

+ 32 - 0
code/base/nckd-jxccl-base-common/src/main/java/nckd/jxccl/base/common/plugins/TabBaseListPlugin.java

@@ -0,0 +1,32 @@
+package nckd.jxccl.base.common.plugins;
+
+import kd.bos.form.control.events.BeforeItemClickEvent;
+import kd.bos.form.control.events.ItemClickListener;
+import kd.bos.list.plugin.AbstractListPlugin;
+import kd.sdk.plugin.Plugin;
+
+import java.util.EventObject;
+
+/**
+* Tab标签基础插件
+* @author W.Y.C
+* @date 2025/12/23 16:58
+* @version 1.0
+*/
+public class TabBaseListPlugin extends AbstractListPlugin implements ItemClickListener {
+
+    public void registerListener(EventObject event) {
+        super.registerListener(event);
+        this.addItemClickListeners(new String[]{"btnclose"});
+    }
+
+    public void beforeItemClick(BeforeItemClickEvent evt) {
+        super.beforeItemClick(evt);
+        String itemKey = evt.getItemKey();
+        if ("nckd_tblclose".equals(itemKey)) {
+            this.getView().getParentView().invokeOperation("close");
+            this.getView().sendFormAction(this.getView().getParentView());
+        }
+
+    }
+}

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

@@ -143,7 +143,7 @@ public class AnnualAdjustmentService {
         if(jobLevel == null){
             String errorMsg = StrFormatter.format("人员【{}】,职位序列【{}】总积分【{}】职称等级【{}】技能等级【{}】考核结果【{}】没有匹配到符合的职级",
                     ac.personName,
-                    ac.jobSeq.getString(FormConstant.NAME_KEY),
+                    ac.jobSeq != null ? ac.jobSeq.getString(FormConstant.NAME_KEY) : "未知",
                     ac.allSumScore.toString(),
                     ac.data.getZgjbName(),
                     ac.data.getZyjndjName(),
@@ -208,7 +208,7 @@ public class AnnualAdjustmentService {
                             //3、判断当前职称或技能等级序号是否大于最小序号
                             //4、如果当前职级序号小于最小序号则认为未达到
                             //这里先不判断,因为其他所有保级情况都已涵盖。剩下的就只有职称或技能达不到了
-                            if (JobSeqEnum.SKILL.getCode().equals(ac.jobSeq.getString(FormConstant.NUMBER_KEY))) {
+                            if (ac.jobSeq != null && JobSeqEnum.SKILL.getCode().equals(ac.jobSeq.getString(FormConstant.NUMBER_KEY))) {
                                 ac.levelKeepReason = 4;
                                 logger.info("保级原因:未聘任高一级的技能");
                             }else{
@@ -316,7 +316,7 @@ public class AnnualAdjustmentService {
             data.setLastJobGradeIndex(jobLevel.getInt(FormConstant.JOBLEVELSEQ));
 
             //---------------------------------- 调整日志 begin ----------------------------------
-            ac.whyAdjust1.add(StrFormatter.format("上一职位序列【{}】", jobSeq.getString(FormConstant.NAME_KEY)));
+            ac.whyAdjust1.add(StrFormatter.format("上一职位序列【{}】", jobSeq != null ? jobSeq.getString(FormConstant.NAME_KEY) : "未知"));
             ac.whyAdjust1.add(StrFormatter.format("上一职位档案总积分【{}】", lastPersonPosFile.getBigDecimal(PositionStructureConstant.NCKD_ALLSUMSCORE)));
             ac.whyAdjust1.add(StrFormatter.format("上一职位档案积分池积分【{}】", data.getLastSumScore()));
 
@@ -359,23 +359,23 @@ public class AnnualAdjustmentService {
             String scoreItemNumber = allowedScore.getScoreItemNumber();
             ScoreItemEnum scoreItemEnum = ScoreItemEnum.getByCode(scoreItemNumber);
             BigDecimal validScore = allowedScore.getValidScore();
-            if(ScoreItemEnum.RESEARCH_SCORE == scoreItemEnum){
+            if(scoreItemEnum != null && ScoreItemEnum.RESEARCH_SCORE == scoreItemEnum){
                 data.setYearscoresuma(validScore);
-            } else if(ScoreItemEnum.PATENT_SCORE == scoreItemEnum){
+            } else if(scoreItemEnum != null && ScoreItemEnum.PATENT_SCORE == scoreItemEnum){
                 data.setYearscoresumb(validScore);
-            } else if(ScoreItemEnum.PAPER_SCORE == scoreItemEnum){
+            } else if(scoreItemEnum != null && ScoreItemEnum.PAPER_SCORE == scoreItemEnum){
                 data.setYearscoresumc(validScore);
-            } else if(ScoreItemEnum.SKILL_CONTEST_SCORE == scoreItemEnum){
+            } else if(scoreItemEnum != null && ScoreItemEnum.SKILL_CONTEST_SCORE == scoreItemEnum){
                 data.setYearscoresumd(validScore);
-            } else if(ScoreItemEnum.TRAINING_MATERIAL_SCORE == scoreItemEnum) {
+            } else if(scoreItemEnum != null && ScoreItemEnum.TRAINING_MATERIAL_SCORE == scoreItemEnum) {
                 data.setYearscoresume(validScore);
-            } else if(ScoreItemEnum.TECH_STANDARD_SCORE == scoreItemEnum){
+            } else if(scoreItemEnum != null && ScoreItemEnum.TECH_STANDARD_SCORE == scoreItemEnum){
                 data.setYearscoresumf(validScore);
-            } else if(ScoreItemEnum.MGMT_SPEC_SCORE == scoreItemEnum){
+            } else if(scoreItemEnum != null && ScoreItemEnum.MGMT_SPEC_SCORE == scoreItemEnum){
                 data.setYearscoresumg(validScore);
-            } else if(ScoreItemEnum.MENTOR_SCORE == scoreItemEnum){
+            } else if(scoreItemEnum != null && ScoreItemEnum.MENTOR_SCORE == scoreItemEnum){
                 data.setYearscoresumh(validScore);
-            } else if(ScoreItemEnum.TRAINING_SCORE == scoreItemEnum){
+            } else if(scoreItemEnum != null && ScoreItemEnum.TRAINING_SCORE == scoreItemEnum){
                 data.setYearscoresumi(validScore);
             }
             allowedScoreSum = allowedScoreSum.add(validScore);
@@ -385,8 +385,9 @@ public class AnnualAdjustmentService {
             //比较实际累计总分和未受限制的实际累计总分
             if(sumScore.compareTo(validScore) != 0){
                 //实际累计积分与有效积分不符,说明被限高
-                ac.whyAdjust1.add(StrFormatter.format("上年度【{}】【{}】积分实际累计总分为【{}】但达到项目最高分限制,最终有效应用分为【{}】;", scoreItemEnum.getName(), sumScore, validScore));
-                logger.warn(StrFormatter.format("上年度【{}】积分实际累计总分为【{}】但达到项目最高分限制,最终有效应用分为【{}】;", scoreItemEnum.getName(), sumScore, validScore));
+                String scoreItemName = scoreItemEnum != null ? scoreItemEnum.getName() : scoreItemNumber;
+                ac.whyAdjust1.add(StrFormatter.format("上年度【{}】【{}】积分实际累计总分为【{}】但达到项目最高分限制,最终有效应用分为【{}】;", scoreItemName, sumScore, validScore));
+                logger.warn(StrFormatter.format("上年度【{}】积分实际累计总分为【{}】但达到项目最高分限制,最终有效应用分为【{}】;", scoreItemName, sumScore, validScore));
             }
 
         }
@@ -659,7 +660,7 @@ public class AnnualAdjustmentService {
         if(jobLevel == null){
             String errorMsg = StrFormatter.format("人员【{}】,职位序列【{}】总积分【{}】职称等级【{}】技能等级【{}】考核结果【{}】没有匹配到符合的职级",
                     ac.personName,
-                    ac.jobSeq.getString(FormConstant.NAME_KEY),
+                    ac.jobSeq != null ? ac.jobSeq.getString(FormConstant.NAME_KEY) : "未知",
                     ac.allSumScore.toString(),
                     ac.data.getZgjbName(),
                     ac.data.getZyjndjName(),
@@ -801,7 +802,7 @@ public class AnnualAdjustmentService {
             if(jobLevel == null){
                 String errorMsg = StrFormatter.format("人员【{}】,职位序列【{}】总积分【{}】职称等级【{}】技能等级【{}】考核结果【{}】没有匹配到符合的职级",
                         ac.personName,
-                        ac.jobSeq.getString(FormConstant.NAME_KEY),
+                        ac.jobSeq != null ? ac.jobSeq.getString(FormConstant.NAME_KEY) : "未知",
                         ac.allSumScore.toString(),
                         ac.data.getZgjbName(),
                         ac.data.getZyjndjName(),

+ 1 - 1
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/helper/ContributionHelper.java

@@ -36,7 +36,7 @@ import java.util.stream.Collectors;
  */
 public class ContributionHelper {
 
-    protected final static Log logger = LogFactory.getLog(AnnualAdjustmentService.class);
+    protected final static Log logger = LogFactory.getLog(ContributionHelper.class);
 
     /**
      * 根据人员获取积分项目有效分数

+ 12 - 0
code/hr/nckd-jxccl-hr/src/main/java/nckd/jxccl/hr/psms/plugin/report/adjust/UnAdjustedReportFormPlugin.java

@@ -5,6 +5,7 @@ import kd.bos.entity.report.ReportQueryParam;
 import kd.bos.form.CloseCallBack;
 import kd.bos.form.FormShowParameter;
 import kd.bos.form.ShowType;
+import kd.bos.form.control.events.BeforeItemClickEvent;
 import kd.bos.form.control.events.ItemClickEvent;
 import kd.bos.form.control.events.ItemClickListener;
 import kd.bos.form.events.ClosedCallBackEvent;
@@ -43,6 +44,7 @@ public class UnAdjustedReportFormPlugin extends AbstractReportFormPlugin impleme
     public void registerListener(EventObject e) {
         //监听工具栏
         this.addItemClickListeners(FormConstant.TOOLBARAP);
+        this.addItemClickListeners(new String[]{"btnclose"});
     }
 
     @Override
@@ -51,6 +53,16 @@ public class UnAdjustedReportFormPlugin extends AbstractReportFormPlugin impleme
         reportList.setSelectedAll(true);
     }
 
+    public void beforeItemClick(BeforeItemClickEvent evt) {
+        super.beforeItemClick(evt);
+        String itemKey = evt.getItemKey();
+        if ("nckd_tblclose".equals(itemKey)) {
+            this.getView().getParentView().invokeOperation("close");
+            this.getView().sendFormAction(this.getView().getParentView());
+        }
+
+    }
+
     @Override
     public void itemClick(ItemClickEvent evt) {
         String itemKey = evt.getItemKey();