|
@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.management.platform.entity.*;
|
|
|
import com.management.platform.entity.dto.QueryVisitPlanDTO;
|
|
|
import com.management.platform.entity.dto.TaskDto;
|
|
|
-import com.management.platform.entity.vo.DailyTaskVO;
|
|
|
-import com.management.platform.entity.vo.MonthActivePlanVO;
|
|
|
-import com.management.platform.entity.vo.VisitPlanDetailVO;
|
|
|
-import com.management.platform.entity.vo.VisitPlanVO;
|
|
|
+import com.management.platform.entity.vo.*;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.SysFunctionService;
|
|
|
import com.management.platform.service.VisitPlanService;
|
|
@@ -56,6 +53,11 @@ public class VisitPlanServiceImpl extends ServiceImpl<VisitPlanMapper, VisitPlan
|
|
|
@Resource
|
|
|
private TaskMapper taskMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private TaskLogMapper taskLogMapper;
|
|
|
+ @Resource
|
|
|
+ private TaskExecutorMapper taskExecutorMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg addOrUpdateVisitPlan(VisitPlan visitPlan, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
@@ -379,6 +381,28 @@ public class VisitPlanServiceImpl extends ServiceImpl<VisitPlanMapper, VisitPlan
|
|
|
LocalDateTime startDateParse = LocalDateTime.parse(calenderDate + " 00:00", formatter);
|
|
|
LocalDateTime endDateParse = startDateParse.plusDays(1L);
|
|
|
List<TaskDto> taskList = taskMapper.getTaskListByStartAndEnd(startDateParse, endDateParse, departmentId, executor, companyId);
|
|
|
+ List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new LambdaQueryWrapper<TaskExecutor>().eq(TaskExecutor::getCompanyId,user.getCompanyId()));
|
|
|
+ List<TaskLog> taskLogList = taskLogMapper.selectList(new LambdaQueryWrapper<TaskLog>().eq(TaskLog::getCompanyId,user.getCompanyId()).orderByDesc(TaskLog::getModTime));
|
|
|
+
|
|
|
+ for (TaskDto taskDto : taskList) {
|
|
|
+ if (!taskExecutorList.isEmpty()){
|
|
|
+ List<TaskExecutor> collect = taskExecutorList.stream().
|
|
|
+ filter(taskExecutor -> taskExecutor.getTaskId().equals(taskDto.getId())).
|
|
|
+ filter(taskExecutor -> taskExecutor.getCompanyId().equals(user.getCompanyId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!collect.isEmpty()){
|
|
|
+ List<String> collect1 = collect.stream().map(TaskExecutor::getExecutorName).collect(Collectors.toList());
|
|
|
+ taskDto.setTaskExecutors(collect1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!taskLogList.isEmpty()){
|
|
|
+ List<TaskLog> collect = taskLogList.stream().filter(taskLog -> taskLog.getTaskId().equals(taskDto.getId()))
|
|
|
+ .filter(taskLog -> taskLog.getCompanyId().equals(user.getCompanyId())).collect(Collectors.toList());
|
|
|
+ if (!collect.isEmpty()){
|
|
|
+ taskDto.setTaskLogs(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
HashMap<String, Object> map = new HashMap<>();
|
|
|
map.put("planList",resPage);
|
|
@@ -438,6 +462,28 @@ public class VisitPlanServiceImpl extends ServiceImpl<VisitPlanMapper, VisitPlan
|
|
|
LocalDateTime parseStartDate = startDate.atStartOfDay(); // 获取开始时间
|
|
|
LocalDateTime parseEndDate = parseStartDate.plusMonths(1L);// 获取结束时间
|
|
|
List<TaskDto> taskList = taskMapper.getTaskListByStartAndEnd(parseStartDate, parseEndDate, departmentId, executor, companyId);
|
|
|
+ List<TaskExecutor> taskExecutorList = taskExecutorMapper.selectList(new LambdaQueryWrapper<TaskExecutor>().eq(TaskExecutor::getCompanyId,user.getCompanyId()));
|
|
|
+ List<TaskLog> taskLogList = taskLogMapper.selectList(new LambdaQueryWrapper<TaskLog>().eq(TaskLog::getCompanyId,user.getCompanyId()).orderByDesc(TaskLog::getModTime));
|
|
|
+
|
|
|
+ for (TaskDto taskDto : taskList) {
|
|
|
+ if (!taskExecutorList.isEmpty()){
|
|
|
+ List<TaskExecutor> collect = taskExecutorList.stream().
|
|
|
+ filter(taskExecutor -> taskExecutor.getTaskId().equals(taskDto.getId())).
|
|
|
+ filter(taskExecutor -> taskExecutor.getCompanyId().equals(user.getCompanyId()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (!collect.isEmpty()){
|
|
|
+ List<String> collect1 = collect.stream().map(TaskExecutor::getExecutorName).collect(Collectors.toList());
|
|
|
+ taskDto.setTaskExecutors(collect1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!taskLogList.isEmpty()){
|
|
|
+ List<TaskLog> collect = taskLogList.stream().filter(taskLog -> taskLog.getTaskId().equals(taskDto.getId()))
|
|
|
+ .filter(taskLog -> taskLog.getCompanyId().equals(user.getCompanyId())).collect(Collectors.toList());
|
|
|
+ if (!collect.isEmpty()){
|
|
|
+ taskDto.setTaskLogs(collect);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
Map<LocalDate, List<TaskDto>> dailyTasks = new LinkedHashMap<>();
|
|
|
|