|
@@ -10,9 +10,6 @@ import kd.bos.dataentity.entity.DynamicObject;
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.dataentity.metadata.IDataEntityProperty;
|
|
import kd.bos.dataentity.metadata.IDataEntityProperty;
|
|
|
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
|
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
|
|
|
-import kd.bos.dataentity.serialization.DataEntitySerializer;
|
|
|
|
|
-import kd.bos.dataentity.serialization.DataEntitySerializerOption;
|
|
|
|
|
-import kd.bos.dtx.util.DynamicObjectSerializeUtil;
|
|
|
|
|
import kd.bos.entity.EntityMetadataCache;
|
|
import kd.bos.entity.EntityMetadataCache;
|
|
|
import kd.bos.entity.MainEntityType;
|
|
import kd.bos.entity.MainEntityType;
|
|
|
import kd.bos.entity.QueryEntityType;
|
|
import kd.bos.entity.QueryEntityType;
|
|
@@ -28,7 +25,6 @@ import kd.bos.entity.filter.CompareTypeEnum;
|
|
|
import kd.bos.entity.filter.FilterValue;
|
|
import kd.bos.entity.filter.FilterValue;
|
|
|
import kd.bos.entity.filter.SimpleFilterRow;
|
|
import kd.bos.entity.filter.SimpleFilterRow;
|
|
|
import kd.bos.entity.operate.result.OperationResult;
|
|
import kd.bos.entity.operate.result.OperationResult;
|
|
|
-import kd.bos.entity.property.entryfilter.EntryQueryParam;
|
|
|
|
|
import kd.bos.form.ConfirmCallBackListener;
|
|
import kd.bos.form.ConfirmCallBackListener;
|
|
|
import kd.bos.form.ConfirmTypes;
|
|
import kd.bos.form.ConfirmTypes;
|
|
|
import kd.bos.form.IClientViewProxy;
|
|
import kd.bos.form.IClientViewProxy;
|
|
@@ -36,7 +32,6 @@ import kd.bos.form.IPageCache;
|
|
|
import kd.bos.form.MessageBoxOptions;
|
|
import kd.bos.form.MessageBoxOptions;
|
|
|
import kd.bos.form.MessageBoxResult;
|
|
import kd.bos.form.MessageBoxResult;
|
|
|
import kd.bos.form.container.Wizard;
|
|
import kd.bos.form.container.Wizard;
|
|
|
-import kd.bos.form.control.Control;
|
|
|
|
|
import kd.bos.form.control.EntryGrid;
|
|
import kd.bos.form.control.EntryGrid;
|
|
|
import kd.bos.form.control.Steps;
|
|
import kd.bos.form.control.Steps;
|
|
|
import kd.bos.form.control.events.StepEvent;
|
|
import kd.bos.form.control.events.StepEvent;
|
|
@@ -52,17 +47,14 @@ import kd.bos.orm.query.QCP;
|
|
|
import kd.bos.orm.query.QFilter;
|
|
import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
-import kd.hdtc.hrcc.common.enums.FileImportSubTaskDealStatusEnum;
|
|
|
|
|
import kd.hr.hbp.business.servicehelper.HRQueryEntityHelper;
|
|
import kd.hr.hbp.business.servicehelper.HRQueryEntityHelper;
|
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
|
-import nckd.jxccl.base.common.constant.QueryConstant;
|
|
|
|
|
import nckd.jxccl.base.common.enums.AppraisalResultEnum;
|
|
import nckd.jxccl.base.common.enums.AppraisalResultEnum;
|
|
|
import nckd.jxccl.base.common.enums.psms.JobSeqEnum;
|
|
import nckd.jxccl.base.common.enums.psms.JobSeqEnum;
|
|
|
import nckd.jxccl.base.common.utils.ConvertUtil;
|
|
import nckd.jxccl.base.common.utils.ConvertUtil;
|
|
|
import nckd.jxccl.base.common.utils.DateUtil;
|
|
import nckd.jxccl.base.common.utils.DateUtil;
|
|
|
import nckd.jxccl.base.common.utils.QueryFieldBuilder;
|
|
import nckd.jxccl.base.common.utils.QueryFieldBuilder;
|
|
|
import nckd.jxccl.base.common.utils.StrFormatter;
|
|
import nckd.jxccl.base.common.utils.StrFormatter;
|
|
|
-import nckd.jxccl.base.hrpi.helper.EmpPosOrgRelHelper;
|
|
|
|
|
import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
|
|
import nckd.jxccl.base.orm.helper.QFilterCommonHelper;
|
|
|
import nckd.jxccl.hr.psms.common.PerfRankMgmtConstant;
|
|
import nckd.jxccl.hr.psms.common.PerfRankMgmtConstant;
|
|
|
import nckd.jxccl.hr.psms.common.PositionStructureConstant;
|
|
import nckd.jxccl.hr.psms.common.PositionStructureConstant;
|
|
@@ -288,6 +280,13 @@ public class PerfRankMgmtFormPlugin extends AbstractFormPlugin implements Wizard
|
|
|
args.setCancel(true);
|
|
args.setCancel(true);
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ int theYear = ConvertUtil.toInt(this.getModel().getValue(PerfRankMgmtConstant.NCKD_THEYEAR));
|
|
|
|
|
+ if(theYear <= 0){
|
|
|
|
|
+ this.getView().showTipNotification("请先填写“年份”");
|
|
|
|
|
+ args.setCancel(true);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
RefObject<String> afterConfirm = new RefObject<>();
|
|
RefObject<String> afterConfirm = new RefObject<>();
|
|
|
if (!operate.getOption().tryGetVariableValue("afterConfirm", afterConfirm)) {
|
|
if (!operate.getOption().tryGetVariableValue("afterConfirm", afterConfirm)) {
|
|
|
//判断是否已获取过名单,如获取过再获取提示用户数据会丢失
|
|
//判断是否已获取过名单,如获取过再获取提示用户数据会丢失
|
|
@@ -471,26 +470,36 @@ public class PerfRankMgmtFormPlugin extends AbstractFormPlugin implements Wizard
|
|
|
}else{*/
|
|
}else{*/
|
|
|
IDataModel model = this.getModel();
|
|
IDataModel model = this.getModel();
|
|
|
DynamicObject adminOrg = ConvertUtil.toDynamicObjectOrNull(model.getValue(FormConstant.NCKD_ADMINORG));
|
|
DynamicObject adminOrg = ConvertUtil.toDynamicObjectOrNull(model.getValue(FormConstant.NCKD_ADMINORG));
|
|
|
|
|
+ int theYear = ConvertUtil.toInt(model.getValue(PerfRankMgmtConstant.NCKD_THEYEAR));
|
|
|
if(adminOrg != null) {
|
|
if(adminOrg != null) {
|
|
|
|
|
+ Date targetDate = DateUtil.toDate(LocalDateTime.of(theYear, 12, 31, 23, 59, 59));
|
|
|
String structLongNumber = adminOrg.getString(FormConstant.STRUCTLONGNUMBER);
|
|
String structLongNumber = adminOrg.getString(FormConstant.STRUCTLONGNUMBER);
|
|
|
//查询所选组织下的人员
|
|
//查询所选组织下的人员
|
|
|
- QFilter qFilter = new QFilter(String.join(".", FormConstant.HRPI_EMPPOSORGREL, FormConstant.ADMINORG, FormConstant.STRUCTLONGNUMBER), QCP.like, structLongNumber + "%");
|
|
|
|
|
|
|
+ //任职状态为在岗,且任职经历的任职类型为全职任职的人员((不含工作性质大类为离岗))
|
|
|
|
|
+ QFilter qFilter = new QFilter(String.join(".",FormConstant.ADMINORG, FormConstant.STRUCTLONGNUMBER), QCP.like, structLongNumber + "%")
|
|
|
|
|
+ .and(FormConstant.STARTDATE, QCP.less_equals, targetDate)
|
|
|
|
|
+ .and(FormConstant.ENDDATE, QCP.large_equals, targetDate);
|
|
|
|
|
+
|
|
|
//在职人员
|
|
//在职人员
|
|
|
qFilter.and(String.join(".", FormConstant.HRPI_EMPENTREL, FormConstant.LABOR_REL_STATUS, FormConstant.IS_HIRED), QCP.equals, EnableEnum.YES.getCode());
|
|
qFilter.and(String.join(".", FormConstant.HRPI_EMPENTREL, FormConstant.LABOR_REL_STATUS, FormConstant.IS_HIRED), QCP.equals, EnableEnum.YES.getCode());
|
|
|
QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
|
|
QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
|
|
|
- .addGroup(new String[]{FormConstant.HRPI_EMPPOSORGREL}, FormConstant.ID_KEY)
|
|
|
|
|
|
|
+ .add(FormConstant.ID_KEY)
|
|
|
|
|
+ .add(FormConstant.STARTDATE)
|
|
|
//用工关系状态.编码(1005_S 在职-试用中、1010_S 在职、1020_S 离职、1030_S 已退休),istrial:是否试用,ishired:是否在职
|
|
//用工关系状态.编码(1005_S 在职-试用中、1010_S 在职、1020_S 离职、1030_S 已退休),istrial:是否试用,ishired:是否在职
|
|
|
.addGroup(new String[]{FormConstant.HRPI_EMPENTREL, FormConstant.LABOR_REL_STATUS}, FormConstant.NUMBER_KEY, FormConstant.NAME_KEY, FormConstant.IS_TRIAL, FormConstant.IS_HIRED)
|
|
.addGroup(new String[]{FormConstant.HRPI_EMPENTREL, FormConstant.LABOR_REL_STATUS}, FormConstant.NUMBER_KEY, FormConstant.NAME_KEY, FormConstant.IS_TRIAL, FormConstant.IS_HIRED)
|
|
|
//任职状态分类(1010_S:在岗,1030_S:不在岗)
|
|
//任职状态分类(1010_S:在岗,1030_S:不在岗)
|
|
|
- .addGroup(new String[]{FormConstant.HRPI_EMPPOSORGREL, FormConstant.POS_STATUS, FormConstant.POST_STATE_CLS}, FormConstant.NUMBER_KEY)
|
|
|
|
|
|
|
+ .addIdNumberName(FormConstant.POS_STATUS, FormConstant.POST_STATE_CLS)
|
|
|
//入职日期
|
|
//入职日期
|
|
|
.addGroup(new String[]{FormConstant.HRPI_EMPENTREL}, FormConstant.ENTRYDATE)
|
|
.addGroup(new String[]{FormConstant.HRPI_EMPENTREL}, FormConstant.ENTRYDATE)
|
|
|
//职务级别
|
|
//职务级别
|
|
|
.addGroup(new String[]{FormConstant.NCKD_HRPI_PARTYPOSH, FormConstant.NCKD_POSGRADE}, FormConstant.NAME_KEY, FormConstant.NUMBER_KEY, FormConstant.NCKD_SORTNUM)
|
|
.addGroup(new String[]{FormConstant.NCKD_HRPI_PARTYPOSH, FormConstant.NCKD_POSGRADE}, FormConstant.NAME_KEY, FormConstant.NUMBER_KEY, FormConstant.NCKD_SORTNUM)
|
|
|
- .addGroup(new String[]{FormConstant.EMPLOYEE_KEY}, FormConstant.ID_KEY, FormConstant.NAME_KEY, FormConstant.EMP_NUMBER_KEY);
|
|
|
|
|
|
|
+ .addGroup(new String[]{FormConstant.EMPLOYEE_KEY}, FormConstant.ID_KEY, FormConstant.NAME_KEY, FormConstant.EMP_NUMBER_KEY)
|
|
|
|
|
+ //工作性质大类
|
|
|
|
|
+ .addIdNumberName(FormConstant.NCKD_HBSS_WORKNATURE,FormConstant.NCKD_JOBTJOBTYPMAIN)
|
|
|
|
|
+ .orderDesc(FormConstant.STARTDATE);
|
|
|
|
|
|
|
|
// -------------------------------- 1、查询组织下的在职人员 --------------------------------
|
|
// -------------------------------- 1、查询组织下的在职人员 --------------------------------
|
|
|
- QueryEntityType queryEntityType = (QueryEntityType) EntityMetadataCache.getDataEntityType(QueryConstant.PERSON_QUERY);
|
|
|
|
|
|
|
+ QueryEntityType queryEntityType = (QueryEntityType) EntityMetadataCache.getDataEntityType("personfilequery");
|
|
|
DynamicObjectCollection personList = HRQueryEntityHelper.getInstance().getQueryDyoColl(queryEntityType, queryFieldBuilder.buildSelect(), new QFilter[]{qFilter}, queryFieldBuilder.buildOrder());
|
|
DynamicObjectCollection personList = HRQueryEntityHelper.getInstance().getQueryDyoColl(queryEntityType, queryFieldBuilder.buildSelect(), new QFilter[]{qFilter}, queryFieldBuilder.buildOrder());
|
|
|
//添加分录
|
|
//添加分录
|
|
|
DynamicObjectCollection entryEntityCols = this.getModel().getDataEntity(true).getDynamicObjectCollection(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);
|
|
DynamicObjectCollection entryEntityCols = this.getModel().getDataEntity(true).getDynamicObjectCollection(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);
|
|
@@ -503,6 +512,22 @@ public class PerfRankMgmtFormPlugin extends AbstractFormPlugin implements Wizard
|
|
|
List<Long> personIds = personList.stream()
|
|
List<Long> personIds = personList.stream()
|
|
|
.map(person -> person.getLong(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY)))
|
|
.map(person -> person.getLong(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY)))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
+ //按员工ID分组,并只取开始日期最新的任职记录
|
|
|
|
|
+ Map<Long, DynamicObject> groupedByEmployee = personList.stream()
|
|
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
|
|
+ person -> person.getLong(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY)),
|
|
|
|
|
+ Collectors.collectingAndThen(
|
|
|
|
|
+ Collectors.maxBy((p1, p2) -> {
|
|
|
|
|
+ Date date1 = p1.getDate(FormConstant.STARTDATE);
|
|
|
|
|
+ Date date2 = p2.getDate(FormConstant.STARTDATE);
|
|
|
|
|
+ if (date1 == null && date2 == null) return 0;
|
|
|
|
|
+ if (date1 == null) return -1;
|
|
|
|
|
+ if (date2 == null) return 1;
|
|
|
|
|
+ return date2.compareTo(date1); // 降序,取最新的
|
|
|
|
|
+ }),
|
|
|
|
|
+ optional -> optional.orElse(null)
|
|
|
|
|
+ )
|
|
|
|
|
+ ));
|
|
|
if (!personIds.isEmpty()) {
|
|
if (!personIds.isEmpty()) {
|
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
|
// -------------------------------- 3、获取人员是否享受职位津贴 --------------------------------
|
|
// -------------------------------- 3、获取人员是否享受职位津贴 --------------------------------
|
|
@@ -511,22 +536,35 @@ public class PerfRankMgmtFormPlugin extends AbstractFormPlugin implements Wizard
|
|
|
// -------------------------------- 4、加载数据到分录 --------------------------------
|
|
// -------------------------------- 4、加载数据到分录 --------------------------------
|
|
|
//预加载任职经历
|
|
//预加载任职经历
|
|
|
List<Long> ids = personList.stream()
|
|
List<Long> ids = personList.stream()
|
|
|
- .map(person -> person.getLong(String.join(".", FormConstant.HRPI_EMPPOSORGREL, FormConstant.ID_KEY)))
|
|
|
|
|
|
|
+ .map(person -> person.getLong(FormConstant.ID_KEY))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
- Map<Long, DynamicObject> empPosOrgRelByEmployeesMap = EmpPosOrgRelHelper.queryEmpPosOrgRelByEmployeesMap(personIds);
|
|
|
|
|
|
|
+ MainEntityType empOrgRelEntityType = EntityMetadataCache.getDataEntityType(FormConstant.HRPI_EMPPOSORGREL);
|
|
|
|
|
+ DynamicObject[] empOrgRelArray = BusinessDataServiceHelper.load(ids.toArray(), empOrgRelEntityType);
|
|
|
|
|
+ Map<Long, DynamicObject> empOrgRelMap = Arrays.stream(empOrgRelArray)
|
|
|
|
|
+ .collect(Collectors.toMap(
|
|
|
|
|
+ obj -> obj.getLong(FormConstant.ID_KEY),
|
|
|
|
|
+ obj -> obj,
|
|
|
|
|
+ (existing, replacement) -> existing
|
|
|
|
|
+ ));
|
|
|
Set<Long> addedPersonIds = new HashSet<>();
|
|
Set<Long> addedPersonIds = new HashSet<>();
|
|
|
- for (DynamicObject person : personList) {
|
|
|
|
|
|
|
+ for (Map.Entry<Long, DynamicObject> personEntry : groupedByEmployee.entrySet()) {
|
|
|
|
|
+ DynamicObject person = personEntry.getValue();
|
|
|
|
|
+ long id = person.getLong(FormConstant.ID_KEY);
|
|
|
long personId = person.getLong(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY));
|
|
long personId = person.getLong(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.ID_KEY));
|
|
|
// 检查人员是否已经添加过,如果已存在则跳过
|
|
// 检查人员是否已经添加过,如果已存在则跳过
|
|
|
if (addedPersonIds.contains(personId)) {
|
|
if (addedPersonIds.contains(personId)) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
+ DynamicObject empPosOrgRel = empOrgRelMap.get(id);
|
|
|
|
|
+ if(empPosOrgRel == null){
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
DynamicObject entryCol = entryEntityCols.addNew();
|
|
DynamicObject entryCol = entryEntityCols.addNew();
|
|
|
addedPersonIds.add(personId); // 记录已添加的人员ID
|
|
addedPersonIds.add(personId); // 记录已添加的人员ID
|
|
|
String personName = person.getString(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.NAME_KEY));
|
|
String personName = person.getString(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.NAME_KEY));
|
|
|
String personNumber = person.getString(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.EMP_NUMBER_KEY));
|
|
String personNumber = person.getString(String.join(".", FormConstant.EMPLOYEE_KEY, FormConstant.EMP_NUMBER_KEY));
|
|
|
|
|
|
|
|
- DynamicObject empPosOrgRel = empPosOrgRelByEmployeesMap.get(personId);
|
|
|
|
|
|
|
+
|
|
|
entryCol.set(FormConstant.NCKD_DEP, empPosOrgRel.get(FormConstant.ADMINORG));
|
|
entryCol.set(FormConstant.NCKD_DEP, empPosOrgRel.get(FormConstant.ADMINORG));
|
|
|
entryCol.set(PositionStructureConstant.NCKD_POSITIONHR, empPosOrgRel.get(FormConstant.POSITION_KEY));
|
|
entryCol.set(PositionStructureConstant.NCKD_POSITIONHR, empPosOrgRel.get(FormConstant.POSITION_KEY));
|
|
|
|
|
|
|
@@ -559,10 +597,23 @@ public class PerfRankMgmtFormPlugin extends AbstractFormPlugin implements Wizard
|
|
|
//判断是否有职位津贴
|
|
//判断是否有职位津贴
|
|
|
boolean hasAllowance = entitledToAllowance.get(personId);
|
|
boolean hasAllowance = entitledToAllowance.get(personId);
|
|
|
entryCol.set(PerfRankMgmtConstant.NCKD_POSTALLOWANCE, hasAllowance);
|
|
entryCol.set(PerfRankMgmtConstant.NCKD_POSTALLOWANCE, hasAllowance);
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
-// this.getModel().updateEntryCache(entryEntityCols);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ this.getModel().updateEntryCache(entryEntityCols);
|
|
|
this.getView().updateView(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);
|
|
this.getView().updateView(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);
|
|
|
|
|
+
|
|
|
|
|
+ /*for (int i = 0; i < entryEntityCols.size(); i++) {
|
|
|
|
|
+ Boolean isRanking = ConvertUtil.toBoolean(this.getModel().getValue(PerfRankMgmtConstant.NCKD_ISRANKING, i));
|
|
|
|
|
+ if(isRanking){
|
|
|
|
|
+ this.getModel().setValue(PerfRankMgmtConstant.NCKD_ISRANKING, Boolean.FALSE,i);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.getModel().setValue(PerfRankMgmtConstant.NCKD_ISRANKING, Boolean.TRUE,i);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.getModel().setValue(PerfRankMgmtConstant.NCKD_ISRANKING, isRanking,i);
|
|
|
|
|
+ this.getView().updateView(PerfRankMgmtConstant.NCKD_ISRANKING,i);
|
|
|
|
|
+
|
|
|
|
|
+ }*/
|
|
|
|
|
+
|
|
|
this.getView().showSuccessNotification("名单获取完成");
|
|
this.getView().showSuccessNotification("名单获取完成");
|
|
|
} else {
|
|
} else {
|
|
|
this.getView().showTipNotification("未获取到人员");
|
|
this.getView().showTipNotification("未获取到人员");
|