Prechádzať zdrojové kódy

测试修改工作计划审核消息提醒

yusm 1 mesiac pred
rodič
commit
c912d1f63a

+ 30 - 3
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/controller/TaskController.java

@@ -499,12 +499,21 @@ public class TaskController {
                 msgRecepientList=new ArrayList<>();
                 log.info("添加工作计划,给第一审核人发送信息提醒");
                 User owner = userMapper.selectById(inchargerId);
+                System.out.println(task.getExecutorList().toString());
                 Information information = new Information();
-                information.setMsg(project.getProjectName()+"项目有新的预计FTE计划审批任务,请您查收.");
+                String executorNames = task.getExecutorList().stream()
+                        .map(TaskExecutor::getExecutorName)
+                        .collect(Collectors.joining(","));
+
+                String infoMsg = project.getProjectName() + "项目有新的预计FTE计划审批任务" +
+                        (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                        ",请您查收.";
+                information.setMsg(infoMsg);
                 information.setTaskId(task.getId());
                 information.setType(11);
                 information.setUserId(owner.getId());
                 information.setTime(LocalDateTime.now());
+                information.setJumpType(3);
                 informationService.save(information);
             }
         } else if (saved && shouldResetAuditStatus) {
@@ -514,7 +523,16 @@ public class TaskController {
             User owner = userMapper.selectById(inchargerId);
             Information information = new Information();
             information.setType(11);
-            information.setMsg(project.getProjectName()+"项目有新的预计FTE计划审批任务,请您查收.");
+            List<TaskExecutor> taskExecutors = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", task.getId()));
+            String executorNames = taskExecutors.stream()
+                    .map(TaskExecutor::getExecutorName)
+                    .collect(Collectors.joining(","));
+
+            String infoMsg = project.getProjectName() + "项目有新的预计FTE计划审批任务" +
+                    (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                    ",请您查收.";
+            information.setMsg(infoMsg);
+            information.setJumpType(3);
             information.setTaskId(task.getId());
             information.setUserId(owner.getId());
             information.setTime(LocalDateTime.now());
@@ -585,6 +603,7 @@ public class TaskController {
         User user = userMapper.selectById(token);
         Task task = taskMapper.selectById(taskId);
         Project project = projectMapper.selectById(task.getProjectId());
+        List<TaskExecutor> taskExecutors = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", task.getId()));
         if (task.getTaskPlan()!=1&&task.getIsTaskPlan()!=1){
             msg.setError("当前计划已变成任务不能撤回计划");
             return msg;
@@ -601,7 +620,15 @@ public class TaskController {
                 Information information = new Information();
 
                 User owner = userMapper.selectById(project.getInchargerId());
-                information.setMsg(project.getProjectName()+"项目有预计FTE计划撤销");
+                String executorNames = taskExecutors.stream()
+                        .map(TaskExecutor::getExecutorName)
+                        .collect(Collectors.joining(","));
+
+                String infoMsg = project.getProjectName() + "项目有新的预计FTE计划审批任务" +
+                        (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                        ",项目有预计FTE计划撤销.";
+                information.setMsg(infoMsg);
+                information.setJumpType(2);
 //                information.setTaskId(task.getId());
                 information.setUserId(owner.getId());
                 information.setType(11);

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/entity/Information.java

@@ -74,6 +74,12 @@ public class Information extends Model<Information> {
     @TableField("task_id")
     private Integer taskId;
 
+    /**
+     * 跳转类型 1、我执行的,2、我创建的、3、待我审核的
+     */
+    @TableField("jump_type")
+    private Integer jumpType;
+
     @TableField(exist = false)
     private GanttDataItem ganttData;
 

+ 69 - 14
fhKeeper/formulahousekeeper/management-platform-mld/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -860,9 +860,17 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 if (projectFirst.isPresent()) {
                     Project project = projectFirst.get();
                     Information information = new Information();
-                    information.setMsg(project.getProjectName()+"项目有新的预计FTE计划审批任务,请您查收.");
+                    String executorNames = task.getExecutorList().stream()
+                            .map(TaskExecutor::getExecutorName)
+                            .collect(Collectors.joining(","));
+
+                    String infoMsg = project.getProjectName() + "项目有新的预计FTE计划审批任务" +
+                            (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                            ",请您查收.";
+                    information.setMsg(infoMsg);
                     information.setTaskId(task.getId());
                     information.setType(11);
+                    information.setJumpType(3);
                     information.setTime(LocalDateTime.now());
                     Optional<User> first = allUserList.stream().filter(u -> u.getId().equals(project.getInchargerId())).findFirst();
                     if (first.isPresent()) {
@@ -1411,11 +1419,20 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                     taskExecutorMapper.updateById(e);
                 });
 
+                List<String> secondAuditorIdList = executorList.stream().distinct().map(TaskExecutor::getSecondAuditorId).collect(Collectors.toList());
                 //给第二审核人发送信息提醒
-                executorList.forEach(e->{
-                    User owner = userMapper.selectById(e.getSecondAuditorId());
+                secondAuditorIdList.forEach(e->{
+                    User owner = userMapper.selectById(e);
                     Information information = new Information();
-                    information.setMsg(project.getProjectName()+"项目有新的预计FTE计划审批任务,请您查收.");
+                    String executorNames = executorList.stream()
+                            .map(TaskExecutor::getExecutorName)
+                            .collect(Collectors.joining(","));
+
+                    String infoMsg = project.getProjectName() + "项目有新的预计FTE计划审批任务" +
+                            (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                            ",请您查收.";
+                    information.setMsg(infoMsg);
+                    information.setJumpType(3);
                     information.setTaskId(task.getId());
                     information.setUserId(owner.getId());
                     information.setType(11);
@@ -1436,9 +1453,17 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                     //给小组长发消息,提醒通过了
                     User owner = userMapper.selectById(task.getCreaterId());
                     Information information = new Information();
-                    information.setMsg("您有工作计划审核通过了");
+                    String executorNames = executorList.stream()
+                            .map(TaskExecutor::getExecutorName)
+                            .collect(Collectors.joining(","));
+
+                    String infoMsg = project.getProjectName() + "项目的FTE计划审批任务" +
+                            (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                            ",工作计划审核通过了.";
+                    information.setMsg(infoMsg);
                     information.setType(11);
                     information.setUserId(owner.getId());
+                    information.setJumpType(2);
                     information.setTime(LocalDateTime.now());
                     informationMapper.insert(information);
 
@@ -1447,10 +1472,11 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                         for (TaskExecutor taskExecutor : executorList) {
                             //给任务的执行人发送信息提醒
                             information = new Information();
-                            information.setMsg("您有新的任务");
+                            information.setMsg(project.getProjectName() + "项目的FTE计划审批任务,您有新的工作计划");
                             information.setContent(taskExecutor.getProjectId()==null?null:(""+taskExecutor.getProjectId()));
-                            information.setType(1);
-                            information.setUserId(owner.getId());
+                            information.setType(11);
+                            information.setJumpType(1);
+                            information.setUserId(taskExecutor.getExecutorId());
                             information.setTime(LocalDateTime.now());
                             informationMapper.insert(information);
                         }
@@ -1474,8 +1500,16 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 //给小组长发送信息提醒
                 User owner = userMapper.selectById(task.getCreaterId());
                 Information information = new Information();
-                information.setMsg("您有工作计划被驳回");
+                String executorNames = executorList.stream()
+                        .map(TaskExecutor::getExecutorName)
+                        .collect(Collectors.joining(","));
+
+                String infoMsg = project.getProjectName() + "项目的FTE计划审批任务" +
+                        (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                        ",工作计划被驳回";
+                information.setMsg(infoMsg);
                 information.setType(11);
+                information.setJumpType(2);
                 information.setUserId(owner.getId());
                 information.setTime(LocalDateTime.now());
                 informationMapper.insert(information);
@@ -1496,8 +1530,16 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 //给小组长发送信息提醒
                 User owner = userMapper.selectById(task.getCreaterId());
                 Information information = new Information();
-                information.setMsg("您有工作计划被驳回");
+                String executorNames = executorList.stream()
+                        .map(TaskExecutor::getExecutorName)
+                        .collect(Collectors.joining(","));
+
+                String infoMsg = project.getProjectName() + "项目的FTE计划审批任务" +
+                        (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                        ",工作计划被驳回";
+                information.setMsg(infoMsg);
                 information.setType(11);
+                information.setJumpType(2);
                 information.setUserId(owner.getId());
                 information.setTime(LocalDateTime.now());
                 informationMapper.insert(information);
@@ -1511,25 +1553,38 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
         HttpRespMsg msg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
         Task task = taskMapper.selectById(id);
+        //给执行人发消息
+        List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", id));
+        Project project = projectMapper.selectById(task.getProjectId());
+
         if (task.getTaskStatus() == TaskController.STATUS_DOING) {
             task.setTaskStatus(TaskController.STATUS_CANCEL);
             taskMapper.updateById(task);
             //给小组长发送信息提醒
             User owner = userMapper.selectById(task.getCreaterId());
+
             Information information = new Information();
-            information.setMsg("您有工作计划被取消");
+            String executorNames = executorList.stream()
+                    .map(TaskExecutor::getExecutorName)
+                    .collect(Collectors.joining(","));
+
+            String infoMsg = project.getProjectName() + "项目" +
+                    (executorNames.isEmpty() ? "" : ",执行人有:" + executorNames) +
+                    ",FTE计划审批任务您有工作计划被取消.";
+            information.setMsg(infoMsg);
             information.setType(11);
+            information.setJumpType(2);
             information.setUserId(owner.getId());
             information.setTime(LocalDateTime.now());
             informationMapper.insert(information);
 
-            //给执行人发消息
-            List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", id));
+
             executorList.forEach(e->{
                 User executor = userMapper.selectById(e.getExecutorId());
                 Information exeInformation = new Information();
-                exeInformation.setMsg("您有工作计划被取消");
+                exeInformation.setMsg(project.getProjectName() + "项目,FTE计划审批任务您有工作计划被取消");
                 exeInformation.setType(11);
+                exeInformation.setJumpType(1);
                 exeInformation.setUserId(executor.getId());
                 exeInformation.setTime(LocalDateTime.now());
                 informationMapper.insert(exeInformation);