Kaynağa Gözat

任务分组 修改负责人 参与人 记录

yurk 2 yıl önce
ebeveyn
işleme
e89c42ca99

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TaskGroupController.java

@@ -199,7 +199,8 @@ public class TaskGroupController {
 
     @RequestMapping("/saveGroupIncharger")
     public HttpRespMsg saveGroupIncharger(TaskGroup taskGroup) {
-        taskGroupService.saveGroupIncharger(taskGroup);
+        User user = userMapper.selectById(request.getHeader("token"));
+        taskGroupService.saveGroupIncharger(taskGroup,user);
         HttpRespMsg msg = new HttpRespMsg();
         return msg;
     }

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TaskGroupService.java

@@ -2,6 +2,7 @@ package com.management.platform.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.entity.TaskGroup;
+import com.management.platform.entity.User;
 import com.management.platform.util.HttpRespMsg;
 
 /**
@@ -14,7 +15,7 @@ import com.management.platform.util.HttpRespMsg;
  */
 public interface TaskGroupService extends IService<TaskGroup> {
 
-    void saveGroupIncharger(TaskGroup taskGroup);
+    void saveGroupIncharger(TaskGroup taskGroup, User user);
 
     HttpRespMsg createFromTemplate(String templateJson, Integer projectId);
 }

+ 23 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/GroupParticipatorServiceImpl.java

@@ -2,19 +2,17 @@ package com.management.platform.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.management.platform.entity.GroupParticipator;
-import com.management.platform.entity.Participation;
-import com.management.platform.mapper.GroupParticipatorMapper;
-import com.management.platform.mapper.ParticipationMapper;
-import com.management.platform.mapper.TaskGroupMapper;
-import com.management.platform.service.GroupParticipatorService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.management.platform.entity.*;
+import com.management.platform.mapper.*;
+import com.management.platform.service.GroupParticipatorService;
 import com.management.platform.service.ParticipationService;
 import com.management.platform.util.HttpRespMsg;
-import org.apache.poi.hssf.record.GroupMarkerSubRecord;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -37,9 +35,18 @@ public class GroupParticipatorServiceImpl extends ServiceImpl<GroupParticipatorM
     private TaskGroupMapper taskGroupMapper;
     @Resource
     private ParticipationService participationService;
+    @Resource
+    private UserMapper userMapper;
+    @Resource
+    private HttpServletRequest request;
+    @Resource
+    private ProjectMapper projectMapper;
+    @Resource
+    private OperationRecordMapper operationRecordMapper;
 
     @Override
     public HttpRespMsg save(Integer groupId, String idsJson) {
+        User user = userMapper.selectById(request.getHeader("token"));
         groupParticipatorMapper.delete(new QueryWrapper<GroupParticipator>().eq("group_id", groupId));
         List<String> idsArray = JSONArray.parseArray(idsJson, String.class);
         List<GroupParticipator> participatorList = new ArrayList<>();
@@ -50,8 +57,17 @@ public class GroupParticipatorServiceImpl extends ServiceImpl<GroupParticipatorM
             participatorList.add(p);
         }
         saveBatch(participatorList);
+        OperationRecord operationRecord=new OperationRecord();
+        operationRecord.setCompanyId(user.getCompanyId());
+        operationRecord.setOperatorName(user.getName());
+        operationRecord.setContent("修改了参与人");
+        operationRecord.setOperationTime(LocalDateTime.now());
+        operationRecord.setModuleName("任务分组");
         //检查项目的参与人里面是否有,如果没有自动加上
         int projectId = taskGroupMapper.selectById(groupId).getProjectId();
+        Project project = projectMapper.selectById(projectId);
+        operationRecord.setProjectName(project.getProjectName());
+        operationRecordMapper.insert(operationRecord);
         List<Participation> proPartList = participationMapper.selectList(new QueryWrapper<Participation>().eq("project_id", projectId));
         List<String> nonList = idsArray.stream().filter(p->!proPartList.stream().anyMatch(pro->pro.getUserId().equals(p))).collect(Collectors.toList());
         if (nonList.size() > 0) {

+ 14 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskGroupServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.util.StringUtils;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -49,13 +50,25 @@ public class TaskGroupServiceImpl extends ServiceImpl<TaskGroupMapper, TaskGroup
     private TaskExecutorService taskExecutorService;
     @Resource
     private ProjectMapper projectMapper;
+    @Resource
+    private OperationRecordMapper operationRecordMapper;
     @Override
-    public void saveGroupIncharger(TaskGroup taskGroup) {
+    public void saveGroupIncharger(TaskGroup taskGroup,User user) {
         if (StringUtils.isEmpty(taskGroup.getInchargerId())) {
             //清除负责人
             taskGroupMapper.removeInchargerId(taskGroup.getId());
         } else {
+            TaskGroup select = taskGroupMapper.selectById(taskGroup.getId());
             taskGroupMapper.updateById(taskGroup);
+            Project project = projectMapper.selectById(taskGroup.getProjectId());
+            OperationRecord operationRecord=new OperationRecord();
+            operationRecord.setOperationTime(LocalDateTime.now());
+            operationRecord.setContent("修改了分组负责人,修改前["+select.getInchargerId()+",修改后["+taskGroup.getInchargerId()+"]");
+            operationRecord.setOperatorName(user.getName());
+            operationRecord.setCompanyId(user.getCompanyId());
+            operationRecord.setModuleName("任务分组");
+            operationRecord.setProjectName(project.getProjectName());
+            operationRecordMapper.insert(operationRecord);
         }
     }