Przeglądaj źródła

导入项目的时候,负责人默认作为日报审核人

yurk 3 lat temu
rodzic
commit
5e464e86e3

+ 18 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -2106,7 +2106,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 if (isPublicCell != null && !StringUtils.isEmpty(isPublicCell.getStringCellValue())) {
                     project.setIsPublic("是".equals(isPublicCell.getStringCellValue())?1:0);
                 }
-                projectMapper.insert(project);
+                if(projectMapper.insert(project)>0){
+                    ProjectAuditor projectAuditor=new ProjectAuditor();
+                    projectAuditor.setAuditorId(project.getInchargerId());
+                    projectAuditor.setAuditorName(project.getInchargerName());
+                    projectAuditor.setProjectId(project.getId());
+                    projectAuditorMapper.insert(projectAuditor);
+                }
                 importCount++;
                 //处理子项目
                 if (subNameCell != null) {
@@ -2126,9 +2132,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 //参与人
                 if (participatorCell != null) {
                     String part = participatorCell.getStringCellValue();
+                    //将项目负责人也添加到参与人当中来
+                    String incharger = inchargerCell.getStringCellValue();
                     if (!StringUtils.isEmpty(part)) {
-                        String[] split = part.split("\\,|\\,");
-                        for (String str : split) {
+                        String[] partSplit = part.split("\\,|\\,");
+                        if(!StringUtils.isEmpty(incharger)){
+                            String[] inchargerSplit = incharger.split("\\,|\\,");
+                            int strLen1 = partSplit.length;// 保存第一个数组长度
+                            int strLen2 = inchargerSplit.length;
+                            partSplit=Arrays.copyOf(partSplit, strLen1+strLen2);
+                            System.arraycopy(inchargerSplit, 0, partSplit, strLen1, strLen2);
+                        }
+                        for (String str : partSplit) {
                             Participation p = new Participation();
                             Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
                             if (first.isPresent()) {