|
@@ -1312,7 +1312,7 @@ public class ReportController {
|
|
//httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
//httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
httpRespMsg.setError("每日工作时长不得少于" + comTimeType.getMinReportTime() + "小时");
|
|
httpRespMsg.setError("每日工作时长不得少于" + comTimeType.getMinReportTime() + "小时");
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
- } else if (dailyWorktime > comTimeType.getMaxReportTime()) {
|
|
|
|
|
|
+ } else if (company.getId() != 4811 && dailyWorktime > comTimeType.getMaxReportTime()) {//陕西柘中不做上限校验
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
//httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
//httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
httpRespMsg.setError("每日工作时长不得超过" + comTimeType.getMaxReportTime() + "小时");
|
|
httpRespMsg.setError("每日工作时长不得超过" + comTimeType.getMaxReportTime() + "小时");
|
|
@@ -1321,46 +1321,48 @@ public class ReportController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
//校验填报工时
|
|
//校验填报工时
|
|
- List<Report> checkedUserDayList = new ArrayList<>();
|
|
|
|
- for (Report report : reportList) {
|
|
|
|
- String creatorId = report.getCreatorId();
|
|
|
|
- LocalDate cDate = report.getCreateDate();
|
|
|
|
- if (checkedUserDayList.stream().anyMatch(item->item.getCreatorId().equals(creatorId) && item.getCreateDate().isEqual(cDate))) {
|
|
|
|
- //避免重复校验
|
|
|
|
- continue;
|
|
|
|
- } else {
|
|
|
|
- //加入
|
|
|
|
- checkedUserDayList.add(report);
|
|
|
|
- }
|
|
|
|
- //查找同一个人同一天的日报合计工作时长
|
|
|
|
- double dailyWorktime = reportList.stream().filter(r->r.getCreatorId().equals(creatorId) && r.getCreateDate().isEqual(cDate)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
- //数据库中已经填报过的工时
|
|
|
|
- if (dailyWorktime > comTimeType.getMaxReportTime()) {
|
|
|
|
- HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
- //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getMaxReportTime()+"小时");
|
|
|
|
- httpRespMsg.setError(MessageUtils.message("profession.MaxReportTimeError",comTimeType.getMaxReportTime()));
|
|
|
|
- return httpRespMsg;
|
|
|
|
- } else {
|
|
|
|
- //查找数据库中可能已有老的记录
|
|
|
|
- List<Report> oldList = reportMapper.selectList(new QueryWrapper<Report>().select("id, state, working_time").eq("create_date", cDate).eq("creator_id", creatorId));
|
|
|
|
- //老的记录需要合并计算不在本次reportList中,并且状态是0(待审核)或者1(已通过)的
|
|
|
|
- //按周填报都可能会有已存在日报的情况,前端没有传过来
|
|
|
|
- double existingWorktime = oldList.stream().filter(old->!reportList.stream().anyMatch(newItem->old.getId().equals(newItem.getId()))
|
|
|
|
- && (old.getState() == 0 || old.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
- if (existingWorktime > 0) {
|
|
|
|
- dailyWorktime += existingWorktime;
|
|
|
|
- if (dailyWorktime > comTimeType.getMaxReportTime()) {
|
|
|
|
- HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
- //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getMaxReportTime()+"小时");
|
|
|
|
- httpRespMsg.setError(MessageUtils.message("profession.MaxReportTimeError",comTimeType.getMaxReportTime()));
|
|
|
|
- return httpRespMsg;
|
|
|
|
|
|
+ if (company.getId() != 4811) {
|
|
|
|
+ List<Report> checkedUserDayList = new ArrayList<>();
|
|
|
|
+ for (Report report : reportList) {
|
|
|
|
+ String creatorId = report.getCreatorId();
|
|
|
|
+ LocalDate cDate = report.getCreateDate();
|
|
|
|
+ if (checkedUserDayList.stream().anyMatch(item->item.getCreatorId().equals(creatorId) && item.getCreateDate().isEqual(cDate))) {
|
|
|
|
+ //避免重复校验
|
|
|
|
+ continue;
|
|
|
|
+ } else {
|
|
|
|
+ //加入
|
|
|
|
+ checkedUserDayList.add(report);
|
|
|
|
+ }
|
|
|
|
+ //查找同一个人同一天的日报合计工作时长
|
|
|
|
+ double dailyWorktime = reportList.stream().filter(r->r.getCreatorId().equals(creatorId) && r.getCreateDate().isEqual(cDate)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
+ //数据库中已经填报过的工时
|
|
|
|
+ if (dailyWorktime > comTimeType.getMaxReportTime()) {
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getMaxReportTime()+"小时");
|
|
|
|
+ httpRespMsg.setError(MessageUtils.message("profession.MaxReportTimeError",comTimeType.getMaxReportTime()));
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ } else {
|
|
|
|
+ //查找数据库中可能已有老的记录
|
|
|
|
+ List<Report> oldList = reportMapper.selectList(new QueryWrapper<Report>().select("id, state, working_time").eq("create_date", cDate).eq("creator_id", creatorId));
|
|
|
|
+ //老的记录需要合并计算不在本次reportList中,并且状态是0(待审核)或者1(已通过)的
|
|
|
|
+ //按周填报都可能会有已存在日报的情况,前端没有传过来
|
|
|
|
+ double existingWorktime = oldList.stream().filter(old->!reportList.stream().anyMatch(newItem->old.getId().equals(newItem.getId()))
|
|
|
|
+ && (old.getState() == 0 || old.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
|
+ if (existingWorktime > 0) {
|
|
|
|
+ dailyWorktime += existingWorktime;
|
|
|
|
+ if (dailyWorktime > comTimeType.getMaxReportTime()) {
|
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
|
+ //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getMaxReportTime()+"小时");
|
|
|
|
+ httpRespMsg.setError(MessageUtils.message("profession.MaxReportTimeError",comTimeType.getMaxReportTime()));
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
//项目所属bu审核
|
|
//项目所属bu审核
|
|
if(comTimeType.getReportAuditType() == 4){
|
|
if(comTimeType.getReportAuditType() == 4){
|
|
List<ProjectCategory> categoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id",company.getId()));
|
|
List<ProjectCategory> categoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id",company.getId()));
|