|
@@ -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) {
|