|
@@ -692,7 +692,6 @@ public class ReportController {
|
|
|
LocalDate curMonthDeadline = LocalDate.now().withDayOfMonth(compTimeType.getFillMonthOnDay());
|
|
|
if (createDate.length > 0) {
|
|
|
String createDateOne = createDate[0];
|
|
|
- //日期都是一样的,取第一个就行了
|
|
|
if (fillMonths == 2) {
|
|
|
//补填到上个月的情况,要检查当前日期,是否在设置的日期之前
|
|
|
LocalDate lastMonth = LocalDate.now().minusMonths(1);
|
|
@@ -712,15 +711,20 @@ public class ReportController {
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- //单日填报,检查日期是否早于限制时间
|
|
|
- if (LocalDate.parse(createDateOne, dateTimeFormatter).isBefore(targetDate)) {
|
|
|
- isForbidden = true;
|
|
|
- } else {
|
|
|
- if (LocalDate.parse(createDateOne, dateTimeFormatter).getMonth().getValue() == lastMonth.getMonth().getValue()) {
|
|
|
- //补填到上个月的情况,要检查当前日期,是否在设置的日期之前
|
|
|
- if (LocalDate.now().isAfter(curMonthDeadline)) {
|
|
|
- isForbidden = true;
|
|
|
- isLastMonthFail = true;
|
|
|
+ //单日或者按周填报
|
|
|
+ String checkDate = getCheckDate(createDate, id);
|
|
|
+ //可能返回的是Null,表示都是待审核或者已通过的
|
|
|
+ if (checkDate != null) {
|
|
|
+ //检查目标是否早于限制时间
|
|
|
+ if (LocalDate.parse(checkDate, dateTimeFormatter).isBefore(targetDate)) {
|
|
|
+ isForbidden = true;
|
|
|
+ } else {
|
|
|
+ if (LocalDate.parse(checkDate, dateTimeFormatter).getMonth().getValue() == lastMonth.getMonth().getValue()) {
|
|
|
+ //补填到上个月的情况,要检查当前日期,是否在设置的日期之前
|
|
|
+ if (LocalDate.now().isAfter(curMonthDeadline)) {
|
|
|
+ isForbidden = true;
|
|
|
+ isLastMonthFail = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -734,10 +738,14 @@ public class ReportController {
|
|
|
isForbidden = true;
|
|
|
}
|
|
|
} else {
|
|
|
- //单日填报,检查日期是否早于限制时间
|
|
|
- if (LocalDate.parse(createDateOne, dateTimeFormatter).isBefore(targetDate)) {
|
|
|
- isForbidden = true;
|
|
|
+ //单日填报,检查日期是否早于限制时间; //可能返回的是Null,表示都是待审核或者已通过的
|
|
|
+ String checkDate = getCheckDate(createDate, id);
|
|
|
+ if (checkDate != null) {
|
|
|
+ if (LocalDate.parse(checkDate, dateTimeFormatter).isBefore(targetDate)) {
|
|
|
+ isForbidden = true;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1238,14 +1246,12 @@ public class ReportController {
|
|
|
}else {
|
|
|
groupSum = needCheckReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
}
|
|
|
- System.out.println("groupSum:"+groupSum);
|
|
|
nowReport = reportList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId()) && targetGpId.equals(rl.getGroupId())).mapToDouble(Report::getWorkingTime).sum();
|
|
|
hasReport = new BigDecimal(groupSum).add(new BigDecimal(nowReport));
|
|
|
TaskGroup tgp = taskGroupService.getById(targetGpId);
|
|
|
//设置的数值大于0时检查是否超额
|
|
|
if (tgp != null && tgp.getManDay() != null && tgp.getManDay() > 0) {
|
|
|
multiply = new BigDecimal(tgp.getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
|
|
|
- System.out.println("hasReport:"+hasReport+" multiply:"+multiply);
|
|
|
if (hasReport.doubleValue() > multiply.doubleValue()) {
|
|
|
if (estimateTimeSetting.getGroupFronzeOnLack() == 1) {
|
|
|
httpRespMsg.setError("超过当前项目["+first.get().getProjectName()+"]分组["+tgp.getName()+"]预算工时,无法继续提交工时");
|
|
@@ -2338,5 +2344,50 @@ public class ReportController {
|
|
|
return reportService.getUserTimeCostByThird(json);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ private String getCheckDate(String[] createDate, Integer[] id) {
|
|
|
+ String checkDate = null;
|
|
|
+ String createDateOne = createDate[0];
|
|
|
+ if (createDate.length == 1) {
|
|
|
+ checkDate = createDateOne;
|
|
|
+ } else {
|
|
|
+ List<Integer> idParams = ListUtil.fromIntegers(id);
|
|
|
+ //只取填报过的日报id,新增加的不用检查
|
|
|
+ idParams = idParams.stream().filter(i->i!=-1).collect(Collectors.toList());
|
|
|
+ if (idParams.size() >0) {
|
|
|
+ //已通过或待审核的日报
|
|
|
+ System.out.println("=============查询已通过或者待审核的日报==================");
|
|
|
+ List<Report> passOrPendingReportList = reportMapper.selectList(new QueryWrapper<Report>().select("id").in("id", idParams).and(reportQueryWrapper -> reportQueryWrapper.eq("state", 1).or().eq("state", 0)));
|
|
|
+ if (passOrPendingReportList.size() > 0) {
|
|
|
+ List<Integer> collect = passOrPendingReportList.stream().map(Report::getId).collect(Collectors.toList());
|
|
|
+ for (int i=0;i<id.length; i++) {
|
|
|
+ if (!collect.contains(id[i])) {
|
|
|
+ if (checkDate == null) {
|
|
|
+ checkDate = createDate[i];
|
|
|
+ } else {
|
|
|
+ //取最早的日期
|
|
|
+ if (createDate[i].compareTo(checkDate) < 0) {
|
|
|
+ checkDate = createDate[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //全是新增的情况,取最早的一个日期
|
|
|
+ for (int i=0;i<createDate.length; i++) {
|
|
|
+ if (checkDate == null) {
|
|
|
+ checkDate = createDate[i];
|
|
|
+ } else {
|
|
|
+ //取最早的日期
|
|
|
+ if (createDate[i].compareTo(checkDate) < 0) {
|
|
|
+ checkDate = createDate[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return checkDate;
|
|
|
+ }
|
|
|
}
|
|
|
|