|
|
@@ -54,6 +54,8 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
|
|
|
|
|
|
@Override
|
|
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
|
|
+ String invoker = (String)this.getOption().getVariables().get(FormConstant.HR_INVOKER_PARAM_INVOKER);
|
|
|
+ boolean dataMigration = FormConstant.DATA_MIGRATION.equalsIgnoreCase(invoker);
|
|
|
e.addValidator(new AbstractValidator() {
|
|
|
@Override
|
|
|
public void validate() {
|
|
|
@@ -87,33 +89,35 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
|
|
|
|
|
|
currentBatchData.computeIfAbsent(personId, k -> new ArrayList<>()).add(perfInfo);
|
|
|
}
|
|
|
- if(!isCycleGenerate) {
|
|
|
- //检查同一批次内同一人员的周期重叠
|
|
|
- for (Map.Entry<Long, List<PersonPerfInfo>> entry : currentBatchData.entrySet()) {
|
|
|
- List<PersonPerfInfo> personPerfList = entry.getValue();
|
|
|
- if (personPerfList.size() > 1) {
|
|
|
- // 对同一人员的多个周期进行相互比较
|
|
|
- for (int i = 0; i < personPerfList.size(); i++) {
|
|
|
- PersonPerfInfo info1 = personPerfList.get(i);
|
|
|
- for (int j = i + 1; j < personPerfList.size(); j++) {
|
|
|
- PersonPerfInfo info2 = personPerfList.get(j);
|
|
|
- String personName = info2.getPerson().getString(FormConstant.NAME_KEY);
|
|
|
-
|
|
|
- // 检查开始年份是否相同
|
|
|
- if (isSameYear(info1.getBeginYear(), info2.getBeginYear())) {
|
|
|
- addFatalErrorMessage(getDataEntities()[info1.getDataEntityIndex()],
|
|
|
- StrFormatter.format("同批次数据中,人员【{}】存在相同的周期开始年份:{}",
|
|
|
- personName, info1.getBeginYear().getYear()));
|
|
|
- } else {
|
|
|
- // 只有开始年份不相同时才检查重叠
|
|
|
- // 检查周期是否重叠
|
|
|
- String overlapInfo = getCycleOverlapInfo(
|
|
|
- info1.getBeginYear(), info1.getEndYear(), null,
|
|
|
- info2.getBeginYear(), info2.getEndYear(), null);
|
|
|
-
|
|
|
- if (StringUtils.isNotBlank(overlapInfo)) {
|
|
|
+ if(!dataMigration) {
|
|
|
+ if (!isCycleGenerate) {
|
|
|
+ //检查同一批次内同一人员的周期重叠
|
|
|
+ for (Map.Entry<Long, List<PersonPerfInfo>> entry : currentBatchData.entrySet()) {
|
|
|
+ List<PersonPerfInfo> personPerfList = entry.getValue();
|
|
|
+ if (personPerfList.size() > 1) {
|
|
|
+ // 对同一人员的多个周期进行相互比较
|
|
|
+ for (int i = 0; i < personPerfList.size(); i++) {
|
|
|
+ PersonPerfInfo info1 = personPerfList.get(i);
|
|
|
+ for (int j = i + 1; j < personPerfList.size(); j++) {
|
|
|
+ PersonPerfInfo info2 = personPerfList.get(j);
|
|
|
+ String personName = info2.getPerson().getString(FormConstant.NAME_KEY);
|
|
|
+
|
|
|
+ // 检查开始年份是否相同
|
|
|
+ if (isSameYear(info1.getBeginYear(), info2.getBeginYear())) {
|
|
|
addFatalErrorMessage(getDataEntities()[info1.getDataEntityIndex()],
|
|
|
- StrFormatter.format("同批次数据中,人员【{}】存在重叠周期:{}", personName, overlapInfo));
|
|
|
+ StrFormatter.format("同批次数据中,人员【{}】存在相同的周期开始年份:{}",
|
|
|
+ personName, info1.getBeginYear().getYear()));
|
|
|
+ } else {
|
|
|
+ // 只有开始年份不相同时才检查重叠
|
|
|
+ // 检查周期是否重叠
|
|
|
+ String overlapInfo = getCycleOverlapInfo(
|
|
|
+ info1.getBeginYear(), info1.getEndYear(), null,
|
|
|
+ info2.getBeginYear(), info2.getEndYear(), null);
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(overlapInfo)) {
|
|
|
+ addFatalErrorMessage(getDataEntities()[info1.getDataEntityIndex()],
|
|
|
+ StrFormatter.format("同批次数据中,人员【{}】存在重叠周期:{}", personName, overlapInfo));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -166,13 +170,15 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
|
|
|
Date actEndYear = dynamicObject.getDate(PerfManagerFormConstant.NCKD_ACTENDYEAR);
|
|
|
LocalDateTime dbActEndYear = actEndYear != null ? DateUtil.toLocalDateTime(actEndYear) : null;
|
|
|
|
|
|
- if(!isCycleGenerate) {
|
|
|
- // 判断周期是否重叠并获取重叠信息,已结束周期使用实际结束时间
|
|
|
- String overlapInfo = getCycleOverlapInfo(beginYear, endYear, null, dbBeginYear, dbEndYear, dbActEndYear);
|
|
|
- if (StringUtils.isNotBlank(overlapInfo)) {
|
|
|
- addFatalErrorMessage(rowDataEntity,
|
|
|
- StrFormatter.format("人员【{}】的考核周期与已有周期在{}重叠,请检查!",
|
|
|
- personName, overlapInfo));
|
|
|
+ if(!dataMigration) {
|
|
|
+ if (!isCycleGenerate) {
|
|
|
+ // 判断周期是否重叠并获取重叠信息,已结束周期使用实际结束时间
|
|
|
+ String overlapInfo = getCycleOverlapInfo(beginYear, endYear, null, dbBeginYear, dbEndYear, dbActEndYear);
|
|
|
+ if (StringUtils.isNotBlank(overlapInfo)) {
|
|
|
+ addFatalErrorMessage(rowDataEntity,
|
|
|
+ StrFormatter.format("人员【{}】的考核周期与已有周期在{}重叠,请检查!",
|
|
|
+ personName, overlapInfo));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|