|
@@ -238,8 +238,15 @@ public class ReportController {
|
|
|
if (fillMonths > 0) {
|
|
|
//有限制的情况
|
|
|
LocalDate curMonth = LocalDate.now();
|
|
|
- LocalDate doorMonth = curMonth.minusMonths(fillMonths-1);
|
|
|
- doorMonth = doorMonth.withDayOfMonth(1);//修改日期为1号
|
|
|
+ LocalDate targetDate = null;
|
|
|
+ if (fillMonths <=3) {
|
|
|
+ targetDate = curMonth.minusMonths(fillMonths-1);
|
|
|
+ targetDate = targetDate.withDayOfMonth(1);//修改日期为1号
|
|
|
+ } else if (fillMonths == 4) {
|
|
|
+ //7天内
|
|
|
+ targetDate = curMonth.minusDays(7);
|
|
|
+ }
|
|
|
+
|
|
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
//检查填报日期,是否早于限制的日期
|
|
|
boolean isForbidden = false;
|
|
@@ -250,19 +257,19 @@ public class ReportController {
|
|
|
String[] dateArray = createDateOne.split("@");
|
|
|
String startDate = dateArray[0];
|
|
|
LocalDate localStartDate = LocalDate.parse(startDate, dateTimeFormatter);
|
|
|
- if (localStartDate.isBefore(doorMonth)) {
|
|
|
+ if (localStartDate.isBefore(targetDate)) {
|
|
|
isForbidden = true;
|
|
|
}
|
|
|
} else {
|
|
|
//单日填报,检查日期是否早于限制时间
|
|
|
- if (LocalDate.parse(createDateOne, dateTimeFormatter).isBefore(doorMonth)) {
|
|
|
+ if (LocalDate.parse(createDateOne, dateTimeFormatter).isBefore(targetDate)) {
|
|
|
isForbidden = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (isForbidden) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
- msg.setError("补填日报不可早于"+dateTimeFormatter.format(doorMonth)+",请联系系统管理员代填。");
|
|
|
+ msg.setError("补填日报不可早于"+dateTimeFormatter.format(targetDate)+",请联系系统管理员代填。");
|
|
|
return msg;
|
|
|
}
|
|
|
}
|