|
@@ -6,13 +6,13 @@ import kd.bos.logging.Log;
|
|
|
import kd.bos.logging.LogFactory;
|
|
import kd.bos.logging.LogFactory;
|
|
|
import kd.bos.orm.query.QCP;
|
|
import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.orm.query.QFilter;
|
|
|
|
|
+import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
|
|
import kd.hr.hbp.business.servicehelper.HRBaseServiceHelper;
|
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
|
import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
|
|
import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
|
|
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Set;
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -25,19 +25,9 @@ public class WTCHelper {
|
|
|
public static final HRBaseServiceHelper HOLIDAYFOROT_HELPER = new HRBaseServiceHelper("nckd_holidayforot");
|
|
public static final HRBaseServiceHelper HOLIDAYFOROT_HELPER = new HRBaseServiceHelper("nckd_holidayforot");
|
|
|
public static final HRBaseServiceHelper OTBILL_HELPER = new HRBaseServiceHelper("wtom_overtimeapplybill");
|
|
public static final HRBaseServiceHelper OTBILL_HELPER = new HRBaseServiceHelper("wtom_overtimeapplybill");
|
|
|
public static final HRBaseServiceHelper OTTYPE_HELPER = new HRBaseServiceHelper("wtbd_ottype");
|
|
public static final HRBaseServiceHelper OTTYPE_HELPER = new HRBaseServiceHelper("wtbd_ottype");
|
|
|
- /**
|
|
|
|
|
- * 根据组织ID列表获取关键岗位信息
|
|
|
|
|
- * @param orgIds 组织ID列表
|
|
|
|
|
- * @return
|
|
|
|
|
- */
|
|
|
|
|
- public static List<Long> getKeyPositionByOrg (List<Long> orgIds) {
|
|
|
|
|
- QFilter filter = new QFilter("nckd_iskeypos", QCP.equals, "1");
|
|
|
|
|
- filter.and(QFilterCommonHelper.getCurrentVersionFilter());
|
|
|
|
|
- filter.and("adminorg.id", QCP.in, orgIds);
|
|
|
|
|
- HRBaseServiceHelper helper = new HRBaseServiceHelper(FormConstant.HBPM_POSITIONHR);
|
|
|
|
|
- DynamicObjectCollection positions = helper.queryOriginalCollection("id", filter.toArray());
|
|
|
|
|
- return positions.stream().map(position -> position.getLong("id")).collect(Collectors.toList());
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ /* 工作流角色 */
|
|
|
|
|
+ public static final HRBaseServiceHelper WFROLE_HELPER = new HRBaseServiceHelper("wf_role");
|
|
|
|
|
+ public static final HRBaseServiceHelper VAAPPLY_HELPER = new HRBaseServiceHelper("wtabm_vaapply");
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 根据考勤档案ID获取二级单位编码
|
|
* 根据考勤档案ID获取二级单位编码
|
|
@@ -91,5 +81,121 @@ public class WTCHelper {
|
|
|
return OTTYPE_HELPER.loadOne(filter.toArray());
|
|
return OTTYPE_HELPER.loadOne(filter.toArray());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据角色编码+用户ID获取工作流角色信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param roleNumber
|
|
|
|
|
+ * @param userId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static DynamicObject getWFRoleByUserId (String roleNumber, long userId) {
|
|
|
|
|
+ QFilter filter = new QFilter("number", QCP.equals, roleNumber);
|
|
|
|
|
+ filter.and("roleentry.user.id", QCP.equals, userId);
|
|
|
|
|
+ return WFROLE_HELPER.queryOriginalOne("roleentry.org.id, roleentry.includadminsub", filter.toArray());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据组织ID列表获取关键岗位信息
|
|
|
|
|
+ * @param orgIds 组织ID列表
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static List<Long> getKeyPositionByOrg (List<Long> orgIds) {
|
|
|
|
|
+ QFilter filter = new QFilter("nckd_iskeypos", QCP.equals, "1");
|
|
|
|
|
+ filter.and(QFilterCommonHelper.getCurrentVersionFilter());
|
|
|
|
|
+ filter.and("adminorg.id", QCP.in, orgIds);
|
|
|
|
|
+ HRBaseServiceHelper helper = new HRBaseServiceHelper(FormConstant.HBPM_POSITIONHR);
|
|
|
|
|
+ DynamicObjectCollection positions = helper.queryOriginalCollection("id", filter.toArray());
|
|
|
|
|
+ return positions.stream().map(position -> position.getLong("id")).collect(Collectors.toList());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取休假单信息
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param positionIds
|
|
|
|
|
+ * @param startDate
|
|
|
|
|
+ * @param endDate
|
|
|
|
|
+ * @param billId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static DynamicObjectCollection getVaApplyInfo (List<Long> positionIds, Date startDate, Date endDate, Long billId) {
|
|
|
|
|
+ QFilter filter = getVaApplyFilter(positionIds, startDate, endDate, billId);
|
|
|
|
|
+ String selectFields = getVaApplySelectFields();
|
|
|
|
|
+ DynamicObjectCollection cols = VAAPPLY_HELPER.queryOriginalCollection(selectFields, filter.toArray());
|
|
|
|
|
+ return cols;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取休假单过滤条件
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param positionIds
|
|
|
|
|
+ * @param startDate
|
|
|
|
|
+ * @param endDate
|
|
|
|
|
+ * @param billId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static QFilter getVaApplyFilter (List<Long> positionIds, Date startDate, Date endDate, Long billId) {
|
|
|
|
|
+ QFilter filter = new QFilter("attfile.position.id", QCP.in, positionIds);
|
|
|
|
|
+ filter.and("applytime", QCP.large_than, BigDecimal.ZERO);
|
|
|
|
|
+ filter.and("billstatus", QCP.in, new HashSet<>(Arrays.asList("B", "C", "D")));
|
|
|
|
|
+ filter.and("id", QCP.not_equals, billId);
|
|
|
|
|
+
|
|
|
|
|
+ String startField = "startdate";
|
|
|
|
|
+ String endField = "enddate";
|
|
|
|
|
+ QFilter startFilter = new QFilter(startField, QCP.less_equals, startDate);
|
|
|
|
|
+ startFilter.and(new QFilter(endField, QCP.large_equals, startDate));
|
|
|
|
|
+
|
|
|
|
|
+ QFilter endFilter = new QFilter(startField, QCP.less_equals, endDate);
|
|
|
|
|
+ endFilter.and(new QFilter(endField, QCP.large_equals, endDate));
|
|
|
|
|
+
|
|
|
|
|
+ QFilter startFilter1 = new QFilter( startField, QCP.large_equals, startDate);
|
|
|
|
|
+ startFilter1.and(new QFilter(startField, QCP.less_than, endDate));
|
|
|
|
|
+
|
|
|
|
|
+ QFilter endFilter1 = new QFilter(endField, QCP.large_equals, startDate);
|
|
|
|
|
+ endFilter1.and(new QFilter( endField, QCP.less_than, endDate));
|
|
|
|
|
+
|
|
|
|
|
+ filter.and(startFilter.or(endFilter).or(startFilter1).or(endFilter1));
|
|
|
|
|
+
|
|
|
|
|
+ return filter;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取休假单查询字段
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static String getVaApplySelectFields() {
|
|
|
|
|
+ String selectFields = "billno, attfile.empnumber, attfile.employee.name, attfile.adminorg.name, attfile.position.name, startdate, enddate";
|
|
|
|
|
+ return selectFields;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据用户ID查询员工ID
|
|
|
|
|
+ * @param userId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ 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");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据employeeId查询任职经历
|
|
|
|
|
+ * @param employeeId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static DynamicObjectCollection queryEmpPosOrgRelDyns (List<Long> employeeId) {
|
|
|
|
|
+ QFilter filter = new QFilter("iscurrentdata", QCP.equals, "1"); // 启用
|
|
|
|
|
+ filter.and(new QFilter("employee.id", QCP.in, employeeId));
|
|
|
|
|
+
|
|
|
|
|
+ String selectFields1 = "adminorg.id";
|
|
|
|
|
+ DynamicObjectCollection empposorgreDyns = QueryServiceHelper.query("hrpi_empposorgrel", selectFields1, filter.toArray());
|
|
|
|
|
+
|
|
|
|
|
+ return empposorgreDyns;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|