|
@@ -20,14 +20,14 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
import org.springblade.core.tool.utils.DateUtil;
|
|
import org.springblade.core.tool.utils.Func;
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
|
+import org.springblade.core.tool.utils.StringUtil;
|
|
|
|
+import org.springblade.system.user.entity.User;
|
|
|
|
+import org.springblade.system.user.feign.IUserClient;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Set;
|
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author Blizzard
|
|
* @author Blizzard
|
|
@@ -42,6 +42,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
private final ITaskFileService taskFileService;
|
|
private final ITaskFileService taskFileService;
|
|
private final IFileAndFolderService fileAndFolderService;
|
|
private final IFileAndFolderService fileAndFolderService;
|
|
private final IFileClient fileClient;
|
|
private final IFileClient fileClient;
|
|
|
|
+ private final IUserClient userClient;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public boolean submit(Task task) {
|
|
public boolean submit(Task task) {
|
|
@@ -189,7 +190,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public MyTaskStatistics TaskStatistics(Long projectId, Integer year, Integer month) {
|
|
|
|
|
|
+ public MyTaskStatistics taskStatistics(Long projectId, Integer year, Integer month) {
|
|
MyTaskStatistics statistics = new MyTaskStatistics();
|
|
MyTaskStatistics statistics = new MyTaskStatistics();
|
|
Long userId = AuthUtil.getUserId();
|
|
Long userId = AuthUtil.getUserId();
|
|
List<Task> tasks = null;
|
|
List<Task> tasks = null;
|
|
@@ -254,10 +255,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
if (month != null) {
|
|
if (month != null) {
|
|
lqw.eq(Task::getMonth, month);
|
|
lqw.eq(Task::getMonth, month);
|
|
}
|
|
}
|
|
- lqw.and(wq -> {
|
|
|
|
- wq.eq(Task::getCreateUser, userId);
|
|
|
|
- wq.or().like(Task::getExecuteUser, String.valueOf(userId));
|
|
|
|
- });
|
|
|
|
|
|
+ lqw.like(Task::getExecuteUser, String.valueOf(userId));
|
|
lqw.orderByAsc(Task::getEndTime);
|
|
lqw.orderByAsc(Task::getEndTime);
|
|
return this.list(lqw);
|
|
return this.list(lqw);
|
|
}
|
|
}
|
|
@@ -321,4 +319,44 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
|
|
public List<Task> getTodoByYear(Set<Long> projectIds, String year) {
|
|
public List<Task> getTodoByYear(Set<Long> projectIds, String year) {
|
|
return baseMapper.getTodoByYear(projectIds, Integer.valueOf(year));
|
|
return baseMapper.getTodoByYear(projectIds, Integer.valueOf(year));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Map<String, Integer>> projectTaskSummary(Long projectId) {
|
|
|
|
+ List<Map<String, Integer>> res = new ArrayList<>();
|
|
|
|
+ //项目下任务执行者的情况
|
|
|
|
+ Set<Long> userIds = new HashSet<>();
|
|
|
|
+ List<Task> tasks = this.listByProjectId(projectId);
|
|
|
|
+ if (!CollectionUtils.isEmpty(tasks)) {
|
|
|
|
+ for (Task task : tasks) {
|
|
|
|
+ String executeUser = task.getExecuteUser();
|
|
|
|
+ if (StringUtil.isNotBlank(executeUser)) {
|
|
|
|
+ List<Long> ids = Func.toLongList(executeUser);
|
|
|
|
+ userIds.addAll(ids);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!CollectionUtils.isEmpty(userIds)) {
|
|
|
|
+ userIds.forEach(userId -> {
|
|
|
|
+ Map<String, Integer> map = new HashMap<>();
|
|
|
|
+ R<User> userR = userClient.userInfoById(userId);
|
|
|
|
+ if (userR.isSuccess()) {
|
|
|
|
+ List<Task> tasks1 = this.listByUserAndProject(userId, projectId);
|
|
|
|
+ if (!CollectionUtils.isEmpty(tasks1)) {
|
|
|
|
+ map.put(userR.getData().getName(), tasks1.size());
|
|
|
|
+ res.add(map);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Task> listByUserAndProject(Long userId, Long projectId) {
|
|
|
|
+ LambdaQueryWrapper<Task> lqw = new LambdaQueryWrapper<>();
|
|
|
|
+ lqw.eq(Task::getProjectId, projectId);
|
|
|
|
+ lqw.like(Task::getExecuteUser, String.valueOf(userId));
|
|
|
|
+ lqw.orderByAsc(Task::getEndTime);
|
|
|
|
+ return this.list(lqw);
|
|
|
|
+ }
|
|
}
|
|
}
|