|
@@ -1359,18 +1359,21 @@ public class ReportController {
|
|
|
}
|
|
|
for (Report report : targetCheckList) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
- Optional<Project> first = targetProjectList.stream().filter(tl -> tl.getId().equals(report.getProjectId())).findFirst();
|
|
|
+ //按项目进行校验
|
|
|
+ Integer curProjectId = report.getProjectId();
|
|
|
+ Optional<Project> first = targetProjectList.stream().filter(tl -> tl.getId().equals(curProjectId)).findFirst();
|
|
|
if(first.isPresent()){
|
|
|
- double nowReport = targetCheckList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId())).mapToDouble(Report::getWorkingTime).sum();
|
|
|
+ //增加项目id过滤
|
|
|
+ double todayProjectTime = targetCheckList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId()) && rl.getProjectId().equals(curProjectId)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
if(first.get().getManDay()!=null && first.get().getManDay()>0){
|
|
|
//已填报的工时情况
|
|
|
double sum;
|
|
|
if(first.get().getManDayStartDate()!=null){
|
|
|
- sum = oldRelatedReportList.stream().filter(npl -> npl.getProjectId().equals(first.get().getId()) &&(npl.getCreateDate().isAfter(first.get().getManDayStartDate())||npl.getCreateDate().isEqual(first.get().getManDayStartDate()))&& (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
+ sum = oldRelatedReportList.stream().filter(npl -> npl.getProjectId().equals(curProjectId) &&(npl.getCreateDate().isAfter(first.get().getManDayStartDate())||npl.getCreateDate().isEqual(first.get().getManDayStartDate()))&& (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
}else {
|
|
|
- sum = oldRelatedReportList.stream().filter(npl -> npl.getProjectId().equals(first.get().getId()) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
+ sum = oldRelatedReportList.stream().filter(npl -> npl.getProjectId().equals(curProjectId) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
}
|
|
|
- BigDecimal hasReport = new BigDecimal(sum).add(new BigDecimal(nowReport));
|
|
|
+ BigDecimal hasReport = new BigDecimal(sum).add(new BigDecimal(todayProjectTime));
|
|
|
BigDecimal multiply = new BigDecimal(first.get().getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
|
|
|
if(hasReport.doubleValue()>multiply.doubleValue()){
|
|
|
sendReportTimeWarningMsg(company, first.get(), null, null);
|
|
@@ -1396,8 +1399,8 @@ public class ReportController {
|
|
|
}else {
|
|
|
groupSum = oldRelatedReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
}
|
|
|
- nowReport = targetCheckList.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));
|
|
|
+ todayProjectTime = targetCheckList.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(todayProjectTime));
|
|
|
TaskGroup tgp = taskGroupService.getById(targetGpId);
|
|
|
//设置的数值大于0时检查是否超额
|
|
|
if (tgp != null && tgp.getManDay() != null && tgp.getManDay() > 0) {
|