Commit c047e1a7 by huangjinxin

fix:修改排班日期推算bug

1 parent d1bdce02
......@@ -187,11 +187,14 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
LocalDate beginDate = DateUtils.localDateFromStr(beginTime);
LocalDate endDate = DateUtils.localDateFromStr(repeatEndDate);
LocalDate current = beginDate;
// 保留固定基准开始时间,后续日历根据此日期推算
final String finalBeginTime = beginTime;
final String finalEndTime = endTime;
while (!current.isAfter(endDate)) {
// 开始时间,结束时间平移
int days = Period.between(beginDate, current).getDays();
beginTime = DateUtils.formatDateTime(DateUtils.localDateTimeFromStr(beginTime).plusDays(days));
endTime = DateUtils.formatDateTime(DateUtils.localDateTimeFromStr(endTime).plusDays(days));
long days = beginDate.until(current, ChronoUnit.DAYS);
beginTime = DateUtils.formatDateTime(DateUtils.localDateTimeFromStr(finalBeginTime).plusDays(days));
endTime = DateUtils.formatDateTime(DateUtils.localDateTimeFromStr(finalEndTime).plusDays(days));
addOneEngineerPlan(userId, engineerCode, type, beginTime, endTime, remark);
current = getNextDate(current, repeatType);
}
......@@ -406,7 +409,7 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
return mapping.get(type);
}
private String newPlanId(){
private String newPlanId() {
String idStr = IdUtil.getSnowflake().nextIdStr();
return idStr.substring(idStr.length() - 10);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!