|
@@ -1193,7 +1193,6 @@ public class ReportController {
|
|
decimalFormat.format(report.getWorkingTime())));
|
|
decimalFormat.format(report.getWorkingTime())));
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//如果开启了加班时长校验
|
|
//如果开启了加班时长校验
|
|
@@ -1219,8 +1218,17 @@ public class ReportController {
|
|
String warningGroupLack = "";
|
|
String warningGroupLack = "";
|
|
EstimateTimeSetting estimateTimeSetting = null;
|
|
EstimateTimeSetting estimateTimeSetting = null;
|
|
if(comTimeType.getProjectManDay()==1){
|
|
if(comTimeType.getProjectManDay()==1){
|
|
- Collection<Integer> projectIds = reportList.stream().map(Report::getProjectId).distinct().collect(Collectors.toList());
|
|
|
|
- List<Report> needCheckReportList = reportMapper.selectList(new QueryWrapper<Report>().in("project_id", projectIds).and(wrapper->wrapper.eq("state",0).or().eq("state",1).or().eq("state",3)));
|
|
|
|
|
|
+ //剔除其中已通过的日报
|
|
|
|
+ List<Integer> filledReportIds = reportList.stream().filter(r->r.getId() != -1).map(Report::getId).collect(Collectors.toList());
|
|
|
|
+ List<Report> targetCheckList = reportList;
|
|
|
|
+ if (filledReportIds.size() > 0) {
|
|
|
|
+ List<Report> passedReportList = reportMapper.selectList(new QueryWrapper<Report>().select("id").in("id", filledReportIds).eq("state", 1));
|
|
|
|
+ if (passedReportList.size() > 0) {
|
|
|
|
+ targetCheckList = reportList.stream().filter(r->!passedReportList.stream().map(Report::getId).collect(Collectors.toList()).contains(r.getId())).collect(Collectors.toList());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Collection<Integer> projectIds = targetCheckList.stream().map(Report::getProjectId).distinct().collect(Collectors.toList());
|
|
|
|
+ List<Report> oldRelatedReportList = reportMapper.selectList(new QueryWrapper<Report>().in("project_id", projectIds).and(wrapper->wrapper.eq("state",0).or().eq("state",1).or().eq("state",3)));
|
|
List<Project> targetProjectList = projectList.stream().filter(pl -> projectIds.contains(pl.getId())).collect(Collectors.toList());
|
|
List<Project> targetProjectList = projectList.stream().filter(pl -> projectIds.contains(pl.getId())).collect(Collectors.toList());
|
|
estimateTimeSetting = estimateTimeSettingMapper.selectById(company.getId());
|
|
estimateTimeSetting = estimateTimeSettingMapper.selectById(company.getId());
|
|
//如果没有设置过项目人天,就初始化一下
|
|
//如果没有设置过项目人天,就初始化一下
|
|
@@ -1230,18 +1238,18 @@ public class ReportController {
|
|
estimateTimeSettingMapper.insert(estimateTimeSetting);
|
|
estimateTimeSettingMapper.insert(estimateTimeSetting);
|
|
estimateTimeSetting = estimateTimeSettingMapper.selectById(company.getId());
|
|
estimateTimeSetting = estimateTimeSettingMapper.selectById(company.getId());
|
|
}
|
|
}
|
|
- for (Report report : reportList) {
|
|
|
|
|
|
+ for (Report report : targetCheckList) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
Optional<Project> first = targetProjectList.stream().filter(tl -> tl.getId().equals(report.getProjectId())).findFirst();
|
|
Optional<Project> first = targetProjectList.stream().filter(tl -> tl.getId().equals(report.getProjectId())).findFirst();
|
|
if(first.isPresent()){
|
|
if(first.isPresent()){
|
|
- double nowReport = reportList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId())).mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
|
|
+ double nowReport = targetCheckList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId())).mapToDouble(Report::getWorkingTime).sum();
|
|
if(first.get().getManDay()!=null){
|
|
if(first.get().getManDay()!=null){
|
|
//已填报的工时情况
|
|
//已填报的工时情况
|
|
double sum;
|
|
double sum;
|
|
if(first.get().getManDayStartDate()!=null){
|
|
if(first.get().getManDayStartDate()!=null){
|
|
- sum = needCheckReportList.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(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();
|
|
}else {
|
|
}else {
|
|
- sum = needCheckReportList.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(first.get().getId()) && (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(nowReport));
|
|
BigDecimal multiply = new BigDecimal(first.get().getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
|
|
BigDecimal multiply = new BigDecimal(first.get().getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
|
|
@@ -1263,11 +1271,11 @@ public class ReportController {
|
|
if (targetGpId != null) {
|
|
if (targetGpId != null) {
|
|
double groupSum = 0;
|
|
double groupSum = 0;
|
|
if(first.get().getManDayStartDate()!=null){
|
|
if(first.get().getManDayStartDate()!=null){
|
|
- groupSum = needCheckReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) &&(npl.getCreateDate().isAfter(first.get().getManDayStartDate())||npl.getCreateDate().isEqual(first.get().getManDayStartDate()))&& (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
|
|
+ groupSum = oldRelatedReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) &&(npl.getCreateDate().isAfter(first.get().getManDayStartDate())||npl.getCreateDate().isEqual(first.get().getManDayStartDate()))&& (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
}else {
|
|
}else {
|
|
- groupSum = needCheckReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
|
|
+ groupSum = oldRelatedReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
}
|
|
}
|
|
- nowReport = reportList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId()) && targetGpId.equals(rl.getGroupId())).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));
|
|
hasReport = new BigDecimal(groupSum).add(new BigDecimal(nowReport));
|
|
TaskGroup tgp = taskGroupService.getById(targetGpId);
|
|
TaskGroup tgp = taskGroupService.getById(targetGpId);
|
|
//设置的数值大于0时检查是否超额
|
|
//设置的数值大于0时检查是否超额
|