|
@@ -35,16 +35,15 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.math.RoundingMode;
|
|
|
import java.time.Duration;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.management.platform.controller.TaskDailyAllocateController.isTaskTimeNonOverlapping;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 前端控制器
|
|
@@ -275,17 +274,34 @@ public class TaskController {
|
|
|
}
|
|
|
}
|
|
|
//检查人员在其他任务上是否有时间冲突
|
|
|
- Integer count = taskMapper.getUserConflitTaskCount(ex.getExecutorId(), task.getId(), task.getStartDate(), task.getEndDate());
|
|
|
- if (count > 0) {
|
|
|
- conflictExecutor.append(ex.getExecutorName()).append(",");
|
|
|
- }
|
|
|
+// Integer count = taskMapper.getUserConflitTaskCount(ex.getExecutorId(), task.getId(), task.getStartDate(), task.getEndDate());
|
|
|
+// if (count > 0) {
|
|
|
+// conflictExecutor.append(ex.getExecutorName()).append(",");
|
|
|
+// }
|
|
|
});
|
|
|
-// if (conflictExecutor.length() > 0) {
|
|
|
-// conflictExecutor.deleteCharAt(conflictExecutor.length() - 1);
|
|
|
-// msg.setError("执行人[" + conflictExecutor.toString() + "]在其他任务上有时间冲突");
|
|
|
-// }
|
|
|
- if (msg.code.equals("error")) {
|
|
|
- return msg;
|
|
|
+ if (!allocateArrayList.isEmpty()) {
|
|
|
+ Map<String, List<TaskDailyAllocate>> map = allocateArrayList.stream().collect(Collectors.groupingBy(TaskDailyAllocate::getUserId));
|
|
|
+ Set<Map.Entry<String, List<TaskDailyAllocate>>> entries = map.entrySet();
|
|
|
+ for (Map.Entry<String, List<TaskDailyAllocate>> entry : entries) {
|
|
|
+ String userIdStr = entry.getKey();
|
|
|
+ List<TaskDailyAllocate> allocates = entry.getValue();
|
|
|
+ User selectUser = userMapper.selectById(userIdStr);
|
|
|
+ if (!allocates.isEmpty()) {
|
|
|
+ String taskTimeNonOverlapping = isTaskTimeNonOverlapping(allocates);
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotEmpty(taskTimeNonOverlapping)){
|
|
|
+ msg.setError("参与人:"+selectUser.getName()+taskTimeNonOverlapping);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (TaskDailyAllocate taskDailyAllocate : allocates) {
|
|
|
+ int count=taskDailyAllocateService.getConflict(taskDailyAllocate, request);
|
|
|
+ if(count>0){
|
|
|
+ msg.setError("参与人:"+selectUser.getName()+"选择时间段:"+taskDailyAllocate.getAllocateDate()+"日:"+taskDailyAllocate.getStartTime()+"--"+taskDailyAllocate.getEndTime()+"跟其他时间段存在冲突");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
executorList.stream().forEach(ex->{
|
|
|
ex.setProjectId(task.getProjectId());
|