|
@@ -10,11 +10,10 @@ import kd.bos.entity.EntityMetadataCache;
|
|
|
import kd.bos.entity.QueryEntityType;
|
|
import kd.bos.entity.QueryEntityType;
|
|
|
import kd.bos.entity.constant.StatusEnum;
|
|
import kd.bos.entity.constant.StatusEnum;
|
|
|
import kd.bos.entity.datamodel.IDataModel;
|
|
import kd.bos.entity.datamodel.IDataModel;
|
|
|
|
|
+import kd.bos.entity.datamodel.ListSelectedRow;
|
|
|
|
|
+import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
|
|
import kd.bos.entity.datamodel.RowDataEntity;
|
|
import kd.bos.entity.datamodel.RowDataEntity;
|
|
|
-import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
|
|
|
|
|
-import kd.bos.entity.datamodel.events.BeforeImportEntryEventArgs;
|
|
|
|
|
-import kd.bos.entity.datamodel.events.ChangeData;
|
|
|
|
|
-import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
|
|
|
|
|
|
+import kd.bos.entity.datamodel.events.*;
|
|
|
import kd.bos.ext.hr.service.query.QueryEntityHelper;
|
|
import kd.bos.ext.hr.service.query.QueryEntityHelper;
|
|
|
import kd.bos.form.ConfirmCallBackListener;
|
|
import kd.bos.form.ConfirmCallBackListener;
|
|
|
import kd.bos.form.ConfirmTypes;
|
|
import kd.bos.form.ConfirmTypes;
|
|
@@ -22,6 +21,7 @@ import kd.bos.form.IClientViewProxy;
|
|
|
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.EntryGrid;
|
|
|
import kd.bos.form.control.Steps;
|
|
import kd.bos.form.control.Steps;
|
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
|
@@ -32,6 +32,7 @@ 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.BusinessDataServiceHelper;
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
import nckd.jxccl.base.common.constant.FormConstant;
|
|
|
import nckd.jxccl.base.common.constant.SystemQueryConstant;
|
|
import nckd.jxccl.base.common.constant.SystemQueryConstant;
|
|
@@ -40,21 +41,17 @@ 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.hrpi.helper.EmpPosOrgRelHelper;
|
|
import nckd.jxccl.base.hrpi.helper.EmpPosOrgRelHelper;
|
|
|
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;
|
|
|
import nckd.jxccl.hr.psms.helper.PositionFileHelper;
|
|
import nckd.jxccl.hr.psms.helper.PositionFileHelper;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
import java.time.temporal.ChronoUnit;
|
|
|
-import java.util.Arrays;
|
|
|
|
|
-import java.util.Collections;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.EventObject;
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-import java.util.Map;
|
|
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
import java.util.stream.Stream;
|
|
|
|
|
|
|
@@ -203,12 +200,98 @@ public class PerfrankMgmtFormPlugin extends AbstractFormPlugin {
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }else if(Arrays.asList(FormConstant.SAVE_OP, FormConstant.SUBMIT_OP).contains(itemKey)){
|
|
|
|
|
|
|
+ } else if(Arrays.asList(FormConstant.SAVE_OP, FormConstant.SUBMIT_OP).contains(itemKey)){
|
|
|
//保存或提交先计算一遍
|
|
//保存或提交先计算一遍
|
|
|
// calcRankCount();
|
|
// calcRankCount();
|
|
|
|
|
+ } else if(FormConstant.DELETEENTRY_OP.equalsIgnoreCase(itemKey)){
|
|
|
|
|
+ //校验人员考评,若考评周期已结束,则禁止删除。
|
|
|
|
|
+ EntryGrid entryGrid = getView().getControl(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);
|
|
|
|
|
+ if (entryGrid != null) {
|
|
|
|
|
+ Integer theYear = ConvertUtil.toInt(this.getModel().getValue(PerfRankMgmtConstant.NCKD_THEYEAR));
|
|
|
|
|
+ LocalDate startDate = LocalDate.of(theYear, 1, 1);
|
|
|
|
|
+ // 获取选中行索引数组
|
|
|
|
|
+ int[] selectedRows = entryGrid.getSelectRows();
|
|
|
|
|
+ List<Long> personIds = new ArrayList<>();
|
|
|
|
|
+ if (selectedRows.length > 0) {
|
|
|
|
|
+ for (int rowIndex : selectedRows) {
|
|
|
|
|
+ DynamicObjectCollection entryEntity = this.getModel().getEntryEntity(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);
|
|
|
|
|
+ DynamicObject rowData = entryEntity.get(rowIndex);
|
|
|
|
|
+ DynamicObject person = rowData.getDynamicObject(FormConstant.NCKD_PERSON);
|
|
|
|
|
+ long personId = person.getLong(FormConstant.ID_KEY);
|
|
|
|
|
+ personIds.add(personId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(!personIds.isEmpty()){
|
|
|
|
|
+ DynamicObject[] byDate = getByDate(DateUtil.toDate(startDate), personIds);
|
|
|
|
|
+ for (DynamicObject dynamicObject : byDate) {
|
|
|
|
|
+ String theStatus = dynamicObject.getString(PerfRankMgmtConstant.NCKD_THESTATUS);
|
|
|
|
|
+ DynamicObject person = dynamicObject.getDynamicObject(FormConstant.NCKD_PERSON);
|
|
|
|
|
+ if(!EnableEnum.YES.getCode().equals(theStatus)){
|
|
|
|
|
+ DynamicObjectCollection entryList = dynamicObject.getDynamicObjectCollection(PerfRankMgmtConstant.NCKD_PERFMANAGERENTRY);
|
|
|
|
|
+ for (DynamicObject object : entryList) {
|
|
|
|
|
+ LocalDateTime appraisalYear = DateUtil.toLocalDateTime(object.getDate(PerfRankMgmtConstant.NCKD_APPRAISALYEAR));
|
|
|
|
|
+ int year = appraisalYear.getYear();
|
|
|
|
|
+ if(year == theYear){
|
|
|
|
|
+ this.getView().showTipNotification(StrFormatter.format("所选人员【{}】考评周期【{}】,不能删除",person.getString(FormConstant.NAME_KEY),"2".equals(theStatus) ? "已锁定":"已结束"));
|
|
|
|
|
+ args.setCancel(true);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据日期查询范围内的考核周期
|
|
|
|
|
+ * 查询逻辑说明:
|
|
|
|
|
+ * 1. 开始时间条件:考核周期的开始年份(NCKD_BEGINYEAR)必须小于等于指定日期
|
|
|
|
|
+ * 2. 结束时间条件:优先使用实际结束年份(NCKD_ACTENDYEAR),如果为空则使用计划结束年份(NCKD_ENDYEAR)
|
|
|
|
|
+ * 3. 结束时间必须大于等于指定日期
|
|
|
|
|
+ * 4. 即查找满足 "NCKD_BEGINYEAR <= date <= (NCKD_ACTENDYEAR为空时取NCKD_ENDYEAR)" 条件的考核周期
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param date 指定查询日期
|
|
|
|
|
+ * @param personIds 人员ID集合
|
|
|
|
|
+ * @return 符合条件的考核周期数组
|
|
|
|
|
+ * @author W.Y.C
|
|
|
|
|
+ * @date 2025/11/4 17:06
|
|
|
|
|
+ */
|
|
|
|
|
+ public static DynamicObject[] getByDate(Date date, Collection<Long> personIds) {
|
|
|
|
|
+ QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
|
|
|
|
|
+ .add(FormConstant.ID_KEY)
|
|
|
|
|
+ .addIdNumberName(FormConstant.NCKD_EMPPOSORGREL)
|
|
|
|
|
+ .addIdNumberName(FormConstant.NCKD_PERSON)
|
|
|
|
|
+ .add(PerfRankMgmtConstant.NCKD_THESTATUS)
|
|
|
|
|
+ .addGroup(new String[]{PerfRankMgmtConstant.NCKD_PERFMANAGERENTRY},
|
|
|
|
|
+ PerfRankMgmtConstant.NCKD_APPRAISALRESULT,
|
|
|
|
|
+ PerfRankMgmtConstant.NCKD_APPRAISALYEAR,
|
|
|
|
|
+ PerfRankMgmtConstant.NCKD_ISALLRANKSOURCE);
|
|
|
|
|
+
|
|
|
|
|
+ // 构造查询条件:日期在[NCKD_BEGINYEAR, NCKD_ENDYEAR]范围内
|
|
|
|
|
+ // 考虑到NCKD_ACTENDYEAR可能为空,优先使用NCKD_ACTENDYEAR作为结束时间
|
|
|
|
|
+ QFilter filter = new QFilter(PerfRankMgmtConstant.NCKD_BEGINYEAR, QCP.less_equals, date)
|
|
|
|
|
+ .and(new QFilter(PerfRankMgmtConstant.NCKD_PERSON, QCP.in, personIds));
|
|
|
|
|
+
|
|
|
|
|
+ // 添加结束时间判断逻辑
|
|
|
|
|
+ QFilter endDateFilter = new QFilter(PerfRankMgmtConstant.NCKD_ACTENDYEAR, QCP.large_equals, date)
|
|
|
|
|
+ .or(new QFilter(PerfRankMgmtConstant.NCKD_ACTENDYEAR, QCP.is_null, null)
|
|
|
|
|
+ .and(new QFilter(PerfRankMgmtConstant.NCKD_ENDYEAR, QCP.large_equals, date)));
|
|
|
|
|
+
|
|
|
|
|
+ filter.and(endDateFilter);
|
|
|
|
|
+
|
|
|
|
|
+ return BusinessDataServiceHelper.load(PerfRankMgmtConstant.PERFMANAGER_ENTITYID,
|
|
|
|
|
+ queryFieldBuilder.buildSelect(), new QFilter[]{filter});
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void beforeDeleteRow(BeforeDeleteRowEventArgs e) {
|
|
|
|
|
+ super.beforeDeleteRow(e);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void confirmCallBack(MessageBoxClosedEvent evt) {
|
|
public void confirmCallBack(MessageBoxClosedEvent evt) {
|
|
|
super.confirmCallBack(evt);
|
|
super.confirmCallBack(evt);
|
|
@@ -373,7 +456,7 @@ public class PerfrankMgmtFormPlugin extends AbstractFormPlugin {
|
|
|
|
|
|
|
|
private void importResultStep() {
|
|
private void importResultStep() {
|
|
|
this.getModel().setValue(PerfRankMgmtConstant.NCKD_STEP,1);
|
|
this.getModel().setValue(PerfRankMgmtConstant.NCKD_STEP,1);
|
|
|
- this.getView().setVisible(false, FormConstant.NUMBER_KEY, FormConstant.NAME_KEY, FormConstant.NCKD_ADMINORG, PerfRankMgmtConstant.NCKD_THEYEAR, PerfRankMgmtConstant.NCKD_GETRANKLIST);
|
|
|
|
|
|
|
+ this.getView().setVisible(false, FormConstant.NUMBER_KEY, PerfRankMgmtConstant.NCKD_GETRANKLIST);
|
|
|
this.getView().setVisible(true, PerfRankMgmtConstant.NCKD_TOPRANKS, PerfRankMgmtConstant.NCKD_ALLOWANCERANKS, PerfRankMgmtConstant.NCKD_FAILS, PerfRankMgmtConstant.NCKD_BASICS, PerfRankMgmtConstant.NCKD_EXCELLENTS, "nckd_advconbaritemap6");
|
|
this.getView().setVisible(true, PerfRankMgmtConstant.NCKD_TOPRANKS, PerfRankMgmtConstant.NCKD_ALLOWANCERANKS, PerfRankMgmtConstant.NCKD_FAILS, PerfRankMgmtConstant.NCKD_BASICS, PerfRankMgmtConstant.NCKD_EXCELLENTS, "nckd_advconbaritemap6");
|
|
|
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);
|
|
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity(PerfRankMgmtConstant.NCKD_PERFRANKMGMTENTRY);
|
|
|
for (int i = 0; i < entryEntity.size(); i++) {
|
|
for (int i = 0; i < entryEntity.size(); i++) {
|