|
|
@@ -360,52 +360,54 @@ public class PerfManagerSaveOpPlugin extends AbstractOperationServicePlugIn impl
|
|
|
LocalDateTime dbEndDate = DateUtil.toLocalDateTime(dbPef.getDate(PerfManagerFormConstant.NCKD_ENDYEAR));
|
|
|
List<Date> dates = archivedPersonYearPairs.get(personId);
|
|
|
// 获取dates中年份最大的日期
|
|
|
- Date maxDate = dates.stream()
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .max(Comparator.comparing(date -> DateUtil.toLocalDateTime(date).getYear()))
|
|
|
- .orElse(null);
|
|
|
- if (maxDate != null) {
|
|
|
- LocalDateTime maxLocalDate = DateUtil.toLocalDateTime(maxDate);
|
|
|
- if (maxLocalDate.getYear() >= dbBeginYear.getYear() || maxLocalDate.getYear() >= dbEndDate.getYear()) {
|
|
|
- //判断本次是否有变更,如果有变更返回错误
|
|
|
- if(!isArchived) {
|
|
|
- if (dbBeginYear.getYear() != beginYear.getYear() || dbEndDate.getYear() != endYear.getYear()) {
|
|
|
- addFatalErrorMessage(rowDataEntity,
|
|
|
- StrFormatter.format("人员【{}】考核周期已归档,不能修改【{}】年及之前的考核周期范围。",
|
|
|
- personName,
|
|
|
- maxLocalDate.getYear()));
|
|
|
+ if(dates != null) {
|
|
|
+ Date maxDate = dates.stream()
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .max(Comparator.comparing(date -> DateUtil.toLocalDateTime(date).getYear()))
|
|
|
+ .orElse(null);
|
|
|
+ if (maxDate != null) {
|
|
|
+ LocalDateTime maxLocalDate = DateUtil.toLocalDateTime(maxDate);
|
|
|
+ if (maxLocalDate.getYear() >= dbBeginYear.getYear() || maxLocalDate.getYear() >= dbEndDate.getYear()) {
|
|
|
+ //判断本次是否有变更,如果有变更返回错误
|
|
|
+ if (!isArchived) {
|
|
|
+ if (dbBeginYear.getYear() != beginYear.getYear() || dbEndDate.getYear() != endYear.getYear()) {
|
|
|
+ addFatalErrorMessage(rowDataEntity,
|
|
|
+ StrFormatter.format("人员【{}】考核周期已归档,不能修改【{}】年及之前的考核周期范围。",
|
|
|
+ personName,
|
|
|
+ maxLocalDate.getYear()));
|
|
|
+ }
|
|
|
+ isArchived = true;
|
|
|
}
|
|
|
- isArchived = true;
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- Date appraisalYear = dbPef.getDate(String.join(".", PerfManagerFormConstant.NCKD_PERFMANAGERENTRY, PerfManagerFormConstant.NCKD_APPRAISALYEAR));
|
|
|
- if (appraisalYear != null) {
|
|
|
- LocalDateTime appraisalYearLocalDate = DateUtil.toLocalDateTime(appraisalYear);
|
|
|
- String dbAppraisalResultNumber = dbPef.getString(String.join(".", PerfManagerFormConstant.NCKD_PERFMANAGERENTRY, PerfManagerFormConstant.NCKD_APPRAISALRESULT, FormConstant.NUMBER_KEY));
|
|
|
- String dbAppraisalResultName = dbPef.getString(String.join(".", PerfManagerFormConstant.NCKD_PERFMANAGERENTRY, PerfManagerFormConstant.NCKD_APPRAISALRESULT, FormConstant.NAME_KEY));
|
|
|
- if(entrys != null && !entrys.isEmpty()) {
|
|
|
- for (DynamicObject entry : entrys) {
|
|
|
- DynamicObject appraisalResult = entry.getDynamicObject(PerfManagerFormConstant.NCKD_APPRAISALRESULT);
|
|
|
- String appraisalResultNumber = appraisalResult != null ? appraisalResult.getString(FormConstant.NUMBER_KEY) : null;
|
|
|
- if (maxLocalDate.getYear() >= appraisalYearLocalDate.getYear()) {
|
|
|
- if (!Objects.equals(appraisalResultNumber, dbAppraisalResultNumber)) {
|
|
|
- addFatalErrorMessage(rowDataEntity,
|
|
|
- StrFormatter.format("人员【{}】考核周期已归档,不能修改【{}】年的考核结果,修改前考核结果【{}】。",
|
|
|
- personName,
|
|
|
- appraisalYearLocalDate.getYear(),
|
|
|
- dbAppraisalResultName));
|
|
|
+ Date appraisalYear = dbPef.getDate(String.join(".", PerfManagerFormConstant.NCKD_PERFMANAGERENTRY, PerfManagerFormConstant.NCKD_APPRAISALYEAR));
|
|
|
+ if (appraisalYear != null) {
|
|
|
+ LocalDateTime appraisalYearLocalDate = DateUtil.toLocalDateTime(appraisalYear);
|
|
|
+ String dbAppraisalResultNumber = dbPef.getString(String.join(".", PerfManagerFormConstant.NCKD_PERFMANAGERENTRY, PerfManagerFormConstant.NCKD_APPRAISALRESULT, FormConstant.NUMBER_KEY));
|
|
|
+ String dbAppraisalResultName = dbPef.getString(String.join(".", PerfManagerFormConstant.NCKD_PERFMANAGERENTRY, PerfManagerFormConstant.NCKD_APPRAISALRESULT, FormConstant.NAME_KEY));
|
|
|
+ if (entrys != null && !entrys.isEmpty()) {
|
|
|
+ for (DynamicObject entry : entrys) {
|
|
|
+ DynamicObject appraisalResult = entry.getDynamicObject(PerfManagerFormConstant.NCKD_APPRAISALRESULT);
|
|
|
+ String appraisalResultNumber = appraisalResult != null ? appraisalResult.getString(FormConstant.NUMBER_KEY) : null;
|
|
|
+ if (maxLocalDate.getYear() >= appraisalYearLocalDate.getYear()) {
|
|
|
+ if (!Objects.equals(appraisalResultNumber, dbAppraisalResultNumber)) {
|
|
|
+ addFatalErrorMessage(rowDataEntity,
|
|
|
+ StrFormatter.format("人员【{}】考核周期已归档,不能修改【{}】年的考核结果,修改前考核结果【{}】。",
|
|
|
+ personName,
|
|
|
+ appraisalYearLocalDate.getYear(),
|
|
|
+ dbAppraisalResultName));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(entrys != null && !entrys.isEmpty()) {
|
|
|
- //原来没有考核结果
|
|
|
- addFatalErrorMessage(rowDataEntity,
|
|
|
- StrFormatter.format("人员【{}】考核周期已归档,不能修改【{}】年及之前的考核结果。",
|
|
|
- personName,
|
|
|
- maxLocalDate.getYear()));
|
|
|
+ } else {
|
|
|
+ if (entrys != null && !entrys.isEmpty()) {
|
|
|
+ //原来没有考核结果
|
|
|
+ addFatalErrorMessage(rowDataEntity,
|
|
|
+ StrFormatter.format("人员【{}】考核周期已归档,不能修改【{}】年及之前的考核结果。",
|
|
|
+ personName,
|
|
|
+ maxLocalDate.getYear()));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|