|
@@ -8344,7 +8344,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Project> inertProjectList=new ArrayList<>();
|
|
|
List<Project> deleteProjectList=new ArrayList<>();
|
|
|
System.out.println("需要处理的数据---------"+projectList);
|
|
|
+ OperationRecord operationRecord=new OperationRecord();
|
|
|
+ operationRecord.setOperationTime(LocalDateTime.now())
|
|
|
+ .setModuleName("项目管理")
|
|
|
+ .setCompanyId(thirdPartyInterface.getCompanyId());
|
|
|
+ StringBuilder sb=new StringBuilder();
|
|
|
if(changeType.equals("insert_project")){
|
|
|
+ sb.append("项目同步操作,新增的项目编号:[");
|
|
|
if(projectList!=null &&projectList.size()>0){
|
|
|
for (Project project : projectList) {
|
|
|
if(timeType.getMainProjectState()==1){
|
|
@@ -8409,14 +8415,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
project.setCompanyId(thirdPartyInterface.getCompanyId());
|
|
|
project.setCreateDate(LocalDate.now());
|
|
|
+ sb.append(project.getProjectCode()+",");
|
|
|
inertProjectList.add(project);
|
|
|
}
|
|
|
if(inertProjectList.size()>0&&saveBatch(inertProjectList)){
|
|
|
//message+="成功添加"+inertProjectList.size()+"条项目数据";
|
|
|
message+=MessageUtils.message("project.upDataSuc",inertProjectList.size());
|
|
|
}
|
|
|
- List<Integer> idList = inertProjectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
- idList.add(-1);
|
|
|
+ List<Participation> participationList=new ArrayList<>();
|
|
|
for (Project project : inertProjectList) {
|
|
|
List<TaskGroup> taskGroupList = project.getTaskGroupList();
|
|
|
if(taskGroupList!=null){
|
|
@@ -8435,9 +8441,28 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
participation.setProjectId(project.getId());
|
|
|
participationMapper.insert(participation);
|
|
|
}
|
|
|
+ //项目参与人处理
|
|
|
+ List<Map<String, Object>> participations = project.getParticipations();
|
|
|
+ if(participations!=null){
|
|
|
+ for (Map<String, Object> map : participations) {
|
|
|
+ Participation p=new Participation();
|
|
|
+ if(map.get("participationId")!=null){
|
|
|
+ Optional<User> first = userList.stream().filter(ul -> ul.getJobNumber() != null && ul.getJobNumber().equals(String.valueOf(map.get("participationId")))).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ p.setProjectId(project.getId());
|
|
|
+ p.setUserId(first.get().getId());
|
|
|
+ participationList.add(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(participationList.size()>0){
|
|
|
+ participationService.saveBatch(participationList);
|
|
|
}
|
|
|
}
|
|
|
}else if(changeType.equals("update_project")){
|
|
|
+ sb.append("项目同步操作,更新的项目编号:[");
|
|
|
if(projectList!=null &&projectList.size()>0){
|
|
|
for (Project project : projectList) {
|
|
|
Optional<Project> first = allProject.stream().filter(ap ->ap.getProjectCode()!=null&& ap.getProjectCode().equals(project.getProjectCode())).findFirst();
|
|
@@ -8449,6 +8474,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if(first.isPresent()){
|
|
|
project.setId(first.get().getId());
|
|
|
project.setCompanyId(thirdPartyInterface.getCompanyId());
|
|
|
+ sb.append(project.getProjectCode()+",");
|
|
|
changeProjectList.add(project);
|
|
|
}else continue;
|
|
|
}
|
|
@@ -8459,6 +8485,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<Integer> idList = changeProjectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
idList.add(-1);
|
|
|
List<TaskGroup> groupList = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().in("project_id", idList));
|
|
|
+ List<Participation> participationList=new ArrayList<>();
|
|
|
for (Project project : changeProjectList) {
|
|
|
List<TaskGroup> taskGroupList = project.getTaskGroupList();
|
|
|
if(taskGroupList!=null){
|
|
@@ -8486,14 +8513,34 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
participation.setProjectId(project.getId());
|
|
|
participationMapper.insert(participation);
|
|
|
}
|
|
|
+ //项目参与人处理 只增不减
|
|
|
+ List<Map<String, Object>> participations = project.getParticipations();
|
|
|
+ if(participations!=null){
|
|
|
+ for (Map<String, Object> map : participations) {
|
|
|
+ Participation p=new Participation();
|
|
|
+ if(map.get("participationId")!=null){
|
|
|
+ Optional<User> first = userList.stream().filter(ul -> ul.getJobNumber() != null && ul.getJobNumber().equals(String.valueOf(map.get("participationId")))).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ p.setProjectId(project.getId());
|
|
|
+ p.setUserId(first.get().getId());
|
|
|
+ participationList.add(p);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(participationList.size()>0){
|
|
|
+ participationService.saveBatch(participationList);
|
|
|
}
|
|
|
}
|
|
|
}else if(changeType.equals("delete_project")){
|
|
|
+ sb.append("项目同步操作,删除的项目名称:[");
|
|
|
for (Project project : projectList) {
|
|
|
Optional<Project> first = allProject.stream().filter(ap ->ap.getProjectCode()!=null&& ap.getProjectCode().equals(project.getProjectCode())).findFirst();
|
|
|
if(first.isPresent()){
|
|
|
project.setId(first.get().getId());
|
|
|
deleteProjectList.add(project);
|
|
|
+ sb.append(project.getProjectCode()+",");
|
|
|
}else continue;
|
|
|
}
|
|
|
List<Integer> idList = deleteProjectList.stream().map(Project::getId).collect(Collectors.toList());
|
|
@@ -8504,6 +8551,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
taskGroupMapper.delete(new QueryWrapper<TaskGroup>().in("project_id",idList));
|
|
|
projectSeparateMapper.delete(new QueryWrapper<ProjectSeparate>().in("id",idList));
|
|
|
}
|
|
|
+ operationRecord.setContent(sb.toString());
|
|
|
+ operationRecordService.save(operationRecord);
|
|
|
msg.data=message;
|
|
|
return msg;
|
|
|
}
|