Browse Source

添加任务的返回字段

yusm 3 months ago
parent
commit
ef19bcc497

+ 11 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/dto/TaskDto.java

@@ -2,10 +2,13 @@ package com.management.platform.entity.dto;
 
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.management.platform.entity.Task;
+import com.management.platform.entity.TaskLog;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.util.List;
+
 @EqualsAndHashCode(callSuper = true)
 @Data
 @Accessors(chain = true)
@@ -28,4 +31,12 @@ public class TaskDto extends Task {
     private String departmentIdByMyselfOrNull;
 
 
+    private List<TaskLog> taskLogs;
+
+    private String contactsPhone;
+
+
+    private List<String> taskExecutors;
+
+
 }

+ 50 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/VisitPlanServiceImpl.java

@@ -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<>();
 

+ 6 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/TaskMapper.xml

@@ -473,7 +473,12 @@
 
     </select>
     <select id="getTaskListByStartAndEnd" resultType="com.management.platform.entity.dto.TaskDto">
-        select DISTINCT task.id,task.task_name,task.start_date,task.end_date,task.status,task.priority
+        select DISTINCT task.* ,
+        custom.custom_name,
+        business_opportunity.name businessName,
+        `sales_order`.order_name ,
+        clue.clue_name,
+        contacts.name contacts_name ,contacts.phone contacts_phone
         from task
         left join  custom on task.custom_id=custom.id
         left join  business_opportunity on task.business_opportunity_id=business_opportunity.id