|
@@ -1155,7 +1155,7 @@ public class ReportController {
|
|
|
}
|
|
|
//校验工作时长
|
|
|
for (Report report : reportList) {
|
|
|
- if (report.getWorkingTime() == null || report.getWorkingTime() <= 0.0) {
|
|
|
+ if (report.getWorkingTime() == null) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
//httpRespMsg.setError("请填写工作时长");
|
|
|
httpRespMsg.setError(MessageUtils.message("profession.duration"));
|
|
@@ -1281,21 +1281,35 @@ public class ReportController {
|
|
|
}
|
|
|
|
|
|
//如果锁定工作时长上限的话,需要校验每日的合计工作时长
|
|
|
- if (comTimeType.getLockWorktime() == 1) {
|
|
|
- for (Report report : reportList) {
|
|
|
- String creatorId = report.getCreatorId();
|
|
|
- LocalDate cDate = report.getCreateDate();
|
|
|
- //查找同一个人同一天的日报合计工作时长
|
|
|
- double dailyWorktime = reportList.stream().filter(r->r.getCreatorId().equals(creatorId) && r.getCreateDate().isEqual(cDate)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
-
|
|
|
+ for (Report report : reportList) {
|
|
|
+ String creatorId = report.getCreatorId();
|
|
|
+ LocalDate cDate = report.getCreateDate();
|
|
|
+ //查找同一个人同一天的日报合计工作时长
|
|
|
+ double dailyWorktime = reportList.stream().filter(r->r.getCreatorId().equals(creatorId) && r.getCreateDate().isEqual(cDate)).mapToDouble(Report::getWorkingTime).sum();
|
|
|
+ if (comTimeType.getLockWorktime() == 1) {
|
|
|
if (dailyWorktime > comTimeType.getAllday()) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
//httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
|
httpRespMsg.setError(MessageUtils.message("profession.MaxReportTimeError",comTimeType.getAllday()));
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //校验上下限
|
|
|
+ if (dailyWorktime < comTimeType.getMinReportTime()) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
|
+ httpRespMsg.setError("每日工作时长不得少于" + comTimeType.getMinReportTime() + "小时");
|
|
|
+ return httpRespMsg;
|
|
|
+ } else if (dailyWorktime > comTimeType.getMaxReportTime()) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ //httpRespMsg.setError("每日工作时长不得超过"+comTimeType.getAllday()+"小时");
|
|
|
+ httpRespMsg.setError("每日工作时长不得超过" + comTimeType.getMaxReportTime() + "小时");
|
|
|
+ return httpRespMsg;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//校验填报工时
|
|
|
List<Report> checkedUserDayList = new ArrayList<>();
|
|
|
for (Report report : reportList) {
|