|
@@ -29,6 +29,7 @@ import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.usermodel.*;
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
import org.apache.poi.xssf.streaming.SXSSFCell;
|
|
import org.apache.poi.xssf.streaming.SXSSFCell;
|
|
@@ -14278,4 +14279,64 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
httpRespMsg.data ="/upload/"+fileName;
|
|
httpRespMsg.data ="/upload/"+fileName;
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg batchSetProjectTaskExecutor(String projectIds, String userIds) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+ List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, companyId));
|
|
|
|
+ if(!StringUtils.isEmpty(projectIds)){
|
|
|
|
+ String[] split = projectIds.split(",");
|
|
|
|
+ List<Integer> projectIdList = Arrays.asList(split).stream().map(i -> Integer.valueOf(i)).collect(Collectors.toList());
|
|
|
|
+ List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getProjectId, projectIdList).eq(Task::getTaskStatus,0));
|
|
|
|
+ List<TaskExecutor> taskExecutorList=new ArrayList<>();
|
|
|
|
+ List<Task> tasks=new ArrayList<>();
|
|
|
|
+ for (Integer projectId : projectIdList) {
|
|
|
|
+ List<Task> targetTaskList = taskList.stream().filter(t -> t.getProjectId().equals(projectId)).collect(Collectors.toList());
|
|
|
|
+ if(!StringUtils.isEmpty(userIds)){
|
|
|
|
+ String[] split1 = userIds.split(",");
|
|
|
|
+ targetTaskList.forEach(t->{
|
|
|
|
+ //获取到原有的执行人
|
|
|
|
+ StringBuilder executorId =new StringBuilder( t.getExecutorId()==null?"":t.getExecutorId());
|
|
|
|
+ StringBuilder executorName = new StringBuilder( t.getExecutorName()==null?"":t.getExecutorName());
|
|
|
|
+ StringBuilder executorColor = new StringBuilder( t.getExecutorColor()==null?"":t.getExecutorColor());
|
|
|
|
+ for (String userId : split1) {
|
|
|
|
+ Optional<User> first = userList.stream().filter(u -> u.getId().equals(userId)).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ TaskExecutor taskExecutor=new TaskExecutor();
|
|
|
|
+ taskExecutor.setExecutorColor(first.get().getColor());
|
|
|
|
+ taskExecutor.setExecutorId(first.get().getId());
|
|
|
|
+ taskExecutor.setExecutorName(first.get().getName());
|
|
|
|
+ taskExecutor.setProjectId(projectId);
|
|
|
|
+ taskExecutor.setTaskId(t.getId());
|
|
|
|
+ if(executorId.length()>0){
|
|
|
|
+ executorId.append(",").append(taskExecutor.getExecutorId());
|
|
|
|
+ executorName.append(",").append(taskExecutor.getExecutorName());
|
|
|
|
+ executorColor.append(",").append(taskExecutor.getExecutorColor());
|
|
|
|
+ }else {
|
|
|
|
+ executorId.append(taskExecutor.getExecutorId());
|
|
|
|
+ executorName.append(taskExecutor.getExecutorName());
|
|
|
|
+ executorColor.append(taskExecutor.getExecutorColor());
|
|
|
|
+ }
|
|
|
|
+ taskExecutorList.add(taskExecutor);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ t.setExecutorId(executorId.toString());
|
|
|
|
+ t.setExecutorName(executorName.toString());
|
|
|
|
+ t.setExecutorColor(executorColor.toString());
|
|
|
|
+ tasks.add(t);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(!taskService.updateBatchById(tasks) ){
|
|
|
|
+ msg.setError("验证失败");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ if(!taskExecutorService.saveBatch(taskExecutorList)){
|
|
|
|
+ msg.setError("验证失败");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
}
|
|
}
|