|
@@ -826,42 +826,50 @@ public class ReportController {
|
|
}
|
|
}
|
|
|
|
|
|
if (!createDate[0].contains("@")) {
|
|
if (!createDate[0].contains("@")) {
|
|
- //不是批量,可能是按周填报
|
|
|
|
- //校验当前填报的日报是否已经存在同日期的
|
|
|
|
- LocalDate startDate = reportList.stream().map(Report::getCreateDate).min(new Comparator<LocalDate>() {
|
|
|
|
- @Override
|
|
|
|
- public int compare(LocalDate o1, LocalDate o2) {
|
|
|
|
- return o1.compareTo(o2);
|
|
|
|
- }
|
|
|
|
- }).get();
|
|
|
|
- LocalDate endDate = reportList.stream().map(Report::getCreateDate).max(new Comparator<LocalDate>() {
|
|
|
|
- @Override
|
|
|
|
- public int compare(LocalDate o1, LocalDate o2) {
|
|
|
|
- return o1.compareTo(o2);
|
|
|
|
- }
|
|
|
|
- }).get();
|
|
|
|
-
|
|
|
|
- List<Report> oldReportList = reportService.list(new QueryWrapper<Report>().between("create_date", startDate, endDate).eq("creator_id", token));
|
|
|
|
- DateTimeFormatter mdFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
- if (oldReportList.size() > 0) {
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
- List<LocalDate> collect = oldReportList.stream().map(Report::getCreateDate).collect(Collectors.toList());
|
|
|
|
- for (Report report : reportList) {
|
|
|
|
- if (report.getId() == null) {
|
|
|
|
- if (collect.stream().anyMatch(oldDate->oldDate.isEqual(report.getCreateDate()))) {
|
|
|
|
- sb.append(mdFormatter.format(report.getCreateDate())).append(",");
|
|
|
|
|
|
+ //不是批量,可能是按周填报。
|
|
|
|
+ boolean isWeeklyFill = true;
|
|
|
|
+ if (reportList.stream().anyMatch(r->r.getId() != null)) {
|
|
|
|
+ //按周填报的都是没有id的,如果有id则说明不是按周填报
|
|
|
|
+ isWeeklyFill = false;
|
|
|
|
+ }
|
|
|
|
+ if (isWeeklyFill) {
|
|
|
|
+ //校验当前填报的日报是否已经存在同日期的
|
|
|
|
+ LocalDate startDate = reportList.stream().map(Report::getCreateDate).min(new Comparator<LocalDate>() {
|
|
|
|
+ @Override
|
|
|
|
+ public int compare(LocalDate o1, LocalDate o2) {
|
|
|
|
+ return o1.compareTo(o2);
|
|
|
|
+ }
|
|
|
|
+ }).get();
|
|
|
|
+ LocalDate endDate = reportList.stream().map(Report::getCreateDate).max(new Comparator<LocalDate>() {
|
|
|
|
+ @Override
|
|
|
|
+ public int compare(LocalDate o1, LocalDate o2) {
|
|
|
|
+ return o1.compareTo(o2);
|
|
|
|
+ }
|
|
|
|
+ }).get();
|
|
|
|
+
|
|
|
|
+ List<Report> oldReportList = reportService.list(new QueryWrapper<Report>().between("create_date", startDate, endDate).eq("creator_id", token));
|
|
|
|
+ DateTimeFormatter mdFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
+ if (oldReportList.size() > 0) {
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ List<LocalDate> collect = oldReportList.stream().map(Report::getCreateDate).collect(Collectors.toList());
|
|
|
|
+ for (Report report : reportList) {
|
|
|
|
+ if (report.getId() == null) {
|
|
|
|
+ if (collect.stream().anyMatch(oldDate->oldDate.isEqual(report.getCreateDate()))) {
|
|
|
|
+ sb.append(mdFormatter.format(report.getCreateDate())).append(",");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- String s = sb.toString();
|
|
|
|
- if (s.length() > 0) {
|
|
|
|
- s = s.substring(0, s.length() -1);
|
|
|
|
- HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
- msg.setError("已存在填写日报: " + s+", 请先删除后再填报。");
|
|
|
|
- return msg;
|
|
|
|
|
|
+ String s = sb.toString();
|
|
|
|
+ if (s.length() > 0) {
|
|
|
|
+ s = s.substring(0, s.length() -1);
|
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
|
+ msg.setError("已存在填写日报: " + s+", 请先删除后再填报。");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
return reportService.editReport(reportList, createDate.length > 0 ? createDate[0] : null, targetUserList, hourCost, user.getCompanyId());
|
|
return reportService.editReport(reportList, createDate.length > 0 ? createDate[0] : null, targetUserList, hourCost, user.getCompanyId());
|