|
|
@@ -158,11 +158,16 @@ public class TenurePersonListListPlugin extends AbstractListPlugin implements Pl
|
|
|
}
|
|
|
LocalDateTime changeTime = DateUtil.toLocalDateTime(record.getDate(MasConstant.NCKD_CHANGETIME));
|
|
|
// 判断记录是否在当年范围内
|
|
|
- return changeTime.getYear() == beginYear.getYear();
|
|
|
+ return changeTime.getYear() <= beginYear.getYear();
|
|
|
})
|
|
|
.max(Comparator.comparing(record -> record.getDate(MasConstant.NCKD_CHANGETIME),
|
|
|
Comparator.nullsFirst(Comparator.naturalOrder())));
|
|
|
-
|
|
|
+ // 如果没有当年范围内的记录,则取所有记录中最新的那条
|
|
|
+ if (!latestRecord.isPresent()) {
|
|
|
+ latestRecord = records.stream()
|
|
|
+ .max(Comparator.comparing(record -> record.getDate(MasConstant.NCKD_CHANGETIME),
|
|
|
+ Comparator.nullsFirst(Comparator.naturalOrder())));
|
|
|
+ }
|
|
|
if (latestRecord.isPresent()) {
|
|
|
DynamicObject currentRecord = latestRecord.get();
|
|
|
latestPartyPoshRecordMap.put(employeeId, currentRecord);
|
|
|
@@ -302,7 +307,8 @@ public class TenurePersonListListPlugin extends AbstractListPlugin implements Pl
|
|
|
//任职结束时间(下一段的变动时间)
|
|
|
Date nextChangeTime = nextPartyPoshRecord.getDate(MasConstant.NCKD_CHANGETIME);
|
|
|
if(nextChangeTime != null) {
|
|
|
- newSubCoHeadService.set(MasConstant.NCKD_ENDDATE, nextChangeTime);
|
|
|
+ LocalDateTime localDateTime = DateUtil.minusDays(DateUtil.toLocalDateTime(changeTime), 1);
|
|
|
+ newSubCoHeadService.set(MasConstant.NCKD_ENDDATE, DateUtil.toDate(localDateTime));
|
|
|
}else{
|
|
|
newSubCoHeadService.set(MasConstant.NCKD_ENDDATE, DateUtil.getMaxDateAsDate());
|
|
|
}
|