|
|
@@ -66,6 +66,7 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
|
|
|
@Override
|
|
|
public void validate() {
|
|
|
//第一个循环先获取表单数据,这里需要兼容单人和批量的数据包
|
|
|
+ Map<Long, List<PersonPerfInfo>> currentBatchData = new HashMap<>();
|
|
|
for (ExtendedDataEntity rowDataEntity : getDataEntities()) {
|
|
|
DynamicObject data = rowDataEntity.getDataEntity();
|
|
|
int dataEntityIndex = rowDataEntity.getDataEntityIndex();
|
|
|
@@ -82,6 +83,47 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
|
|
|
personBeginYearMap.put(personId, beginYear);
|
|
|
}
|
|
|
ids.add(id);
|
|
|
+
|
|
|
+ PersonPerfInfo perfInfo = new PersonPerfInfo(person, null,
|
|
|
+ data.getDate(PerfManagerFormConstant.NCKD_BEGINYEAR),
|
|
|
+ data.getDate(PerfManagerFormConstant.NCKD_ENDYEAR),
|
|
|
+ data.getString(FormConstant.DESCRIPTION_KEY),
|
|
|
+ rowDataEntity.getDataEntityIndex());
|
|
|
+
|
|
|
+ currentBatchData.computeIfAbsent(personId, k -> new ArrayList<>()).add(perfInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ //检查同一批次内同一人员的周期重叠
|
|
|
+ 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)) {
|
|
|
+ addFatalErrorMessage(getDataEntities()[info1.getDataEntityIndex()],
|
|
|
+ StrFormatter.format("同批次数据中,人员【{}】存在重叠周期:{}",personName ,overlapInfo));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
QueryFieldBuilder queryFieldBuilder = QueryFieldBuilder.create()
|