Forráskód Böngészése

refactor(swc): 优化员工ID查询逻辑并移除冗余代码

- 将 SelfSearchFormPlugin 中的员工 ID 查询方式替换为 SWCHelper 实现
- 在 SWCHelper 中新增 queryEmployeeIdByUserId 方法,用于根据用户 ID 查询员工 ID
- 移除了 WtcUtils 中对 WTCAppContextHelper 的依赖及相关冗余配置读取逻辑
- 在 WtcConstant 中增加了调度作业、运行日志和考勤档案相关的服务助手常量
Tyx 2 napja
szülő
commit
eb9cfc4d4f

+ 7 - 0
code/base/nckd-jxccl-base-helper/src/main/java/nckd/jxccl/base/swc/helper/SWCHelper.java

@@ -9,6 +9,7 @@ import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.bos.servicehelper.BusinessDataServiceHelper;
 import kd.bos.servicehelper.QueryServiceHelper;
+import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
 
 import java.util.Date;
 import java.util.List;
@@ -144,6 +145,12 @@ public class SWCHelper {
     }
 
 
+    public static Long queryEmployeeIdByUserId(Long userId) {
+        HRBaseServiceHelper SERVICE_HELPER = new HRBaseServiceHelper("hrpi_personuserrel");
+        DynamicObject personuserrel = SERVICE_HELPER.queryOne("employee,user,createtime", new QFilter[]{new QFilter("user", "=", userId), new QFilter("enable", "=", "1")}, "createtime desc");
+        return personuserrel == null ? 0L : personuserrel.getLong("employee_id");
+    }
+
 
     /**
      * 判断集合是否为空

+ 2 - 2
code/swc/nckd-jxccl-swc/src/main/java/nckd/jxccl/sit/hcsi/formplugin/web/selfsearch/SelfSearchFormPlugin.java

@@ -10,8 +10,8 @@ import kd.bos.form.plugin.AbstractFormPlugin;
 import kd.bos.orm.query.QCP;
 import kd.bos.orm.query.QFilter;
 import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
-import kd.hrmp.hrobs.business.domain.assignment.service.IAssignmentDomainService;
 import kd.sdk.plugin.Plugin;
+import nckd.jxccl.base.swc.helper.SWCHelper;
 
 import java.util.EventObject;
 
@@ -52,7 +52,7 @@ public class SelfSearchFormPlugin extends AbstractFormPlugin implements Plugin {
             }
             else {
                 // 获取当前登录用户对应的HR人员
-                Long employeeId = IAssignmentDomainService.getInstance().queryEmployeeIdByUserId(RequestContext.getOrCreate().getCurrUserId());
+                Long employeeId = SWCHelper.queryEmployeeIdByUserId(RequestContext.getOrCreate().getCurrUserId());
                 if (employeeId != 0L) {
                     doSearch(period.getLong("id"), employeeId);
                 }

+ 5 - 0
code/wtc/nckd-jxccl-wtc/src/main/java/nckd/jxccl/wtc/wtabm/web/common/constant/WtcConstant.java

@@ -47,6 +47,11 @@ public class WtcConstant {
 
     /* 打卡记录 */
     public static final HRBaseServiceHelper PUNCHCARDDATA_HELPER = new HRBaseServiceHelper("wtis_punchcarddata");
+    /* 调度作业 */
     public static final HRBaseServiceHelper JOB_HELPER = new HRBaseServiceHelper("sch_job");
+    /* 运行日志 */
     public static final HRBaseServiceHelper TASK_HELPER = new HRBaseServiceHelper("sch_task");
+
+    /* 考勤档案 */
+    public static final HRBaseServiceHelper ATTFILEBASE_HELPER = new HRBaseServiceHelper("wtp_attfilebase");
 }

+ 1 - 10
code/wtc/nckd-jxccl-wtc/src/main/java/nckd/jxccl/wtc/wtabm/web/common/util/WtcUtils.java

@@ -14,7 +14,6 @@ import kd.bos.servicehelper.QueryServiceHelper;
 import kd.hr.haos.business.domain.adminorg.service.impl.AdminOrgQueryServiceHelper;
 import kd.hr.hbp.common.util.HRDateTimeUtils;
 import kd.hr.hbp.common.util.HRStringUtils;
-import kd.wtc.wtbs.common.helper.WTCAppContextHelper;
 import org.apache.commons.lang3.ObjectUtils;
 
 import java.time.LocalDate;
@@ -115,15 +114,7 @@ public class WtcUtils {
             Date beginDate = model.getDataEntity().getDate(beginDateKer);
             Date endDate = model.getDataEntity().getDate(endDateKer);
             if (beginDate != null && endDate != null) {
-                int addMonth;
-                try {
-                    addMonth = WTCAppContextHelper.getWTCParamWithSystemCompat().getIntValue("kd.wtc.wtte.attreport.queryRangeMonth", 1);
-                    if (addMonth <= 0) {
-                        addMonth = 1;
-                    }
-                } catch (Exception var9) {
-                    addMonth = 1;
-                }
+                int addMonth = 1;
 
                 Date date = HRDateTimeUtils.addMonth(beginDate, addMonth);
                 if (!endDate.before(date)) {