Min 1 year ago
parent
commit
516211002c

+ 69 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -3743,11 +3743,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     XSSFCell participatorCell = row.getCell(5);
                     XSSFCell inchargerCell = row.getCell(6);
                     XSSFCell reportAuditorsCell=null;
+                    XSSFCell reportCcCell=null;
                     int i=0;
                     if(timeType.getReportAuditType()==0||timeType.getReportAuditType()==4){
                         i++;
                         reportAuditorsCell = row.getCell(6+i);
                     }
+                    if(timeType.getReportAuditType()==6){
+                        i++;
+                        reportCcCell=row.getCell(6+i);
+                    }
                     XSSFCell levelCell = row.getCell(7+i);
                     XSSFCell startDateCell = row.getCell(8+i);
                     XSSFCell endDateCell = row.getCell(9+i);
@@ -3762,6 +3767,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     if (participatorCell != null)participatorCell.setCellType(CellType.STRING);
                     if (inchargerCell != null)inchargerCell.setCellType(CellType.STRING);
                     if (reportAuditorsCell != null)reportAuditorsCell.setCellType(CellType.STRING);
+                    if (reportCcCell != null)reportCcCell.setCellType(CellType.STRING);
                     if (levelCell != null)levelCell.setCellType(CellType.STRING);
                     if (startDateCell != null)startDateCell.setCellType(CellType.NUMERIC);
                     if (endDateCell != null)endDateCell.setCellType(CellType.NUMERIC);
@@ -4111,6 +4117,69 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                 }
                                 if (first.isPresent()) {
                                     User partMemb = first.get();
+//                                    System.out.println("参与人:"+partMemb.getName());
+                                    if (!projectAuditorList.stream().anyMatch(partOne->partOne.getAuditorId().equals(partMemb.getId()))) {
+                                        projectAuditor.setAuditorId(partMemb.getId());
+                                        projectAuditor.setAuditorName(partMemb.getName());
+                                        projectAuditor.setProjectId(project.getId());
+                                        projectAuditorList.add(projectAuditor);
+                                    }
+                                } else {
+                                    switch (exception){
+                                        case 0:throw new Exception("["+split[0]+"]在系统中不存在");
+                                        case 1:throw new Exception("["+split[0]+"]在系统中不存在");
+                                    }
+                                }
+                            }
+                        }
+                    }
+                    if (projectAuditorList.size() > 0) {
+                        //批量保存
+                        List<ProjectAuditor> finalOldAuditorList = oldAuditorList;
+                        List<ProjectAuditor> addAuditorList = projectAuditorList.stream().filter(newP-> !finalOldAuditorList.stream().anyMatch(oldP->oldP.getAuditorId().equals(newP.getAuditorId()))).collect(Collectors.toList());
+                        if (addAuditorList.size() > 0) {
+                            projectAuditorService.saveBatch(addAuditorList);
+                        }
+                    }
+                    if (reportCcCell != null) {
+                        String part = reportCcCell.getStringCellValue().trim();
+                        if (!StringUtils.isEmpty(part)) {
+                            String[] partSplit = part.split("\\,|\\,");
+                            for (String str : partSplit) {
+                                if(str.equals(inchargerCell.getStringCellValue())){
+                                    continue;
+                                }
+                                ProjectAuditor projectAuditor = new ProjectAuditor();
+                                String s1;
+                                if(str.startsWith("/")){
+                                    s1=str.substring(1,str.length());
+                                }else s1=str;
+                                String s2;
+                                if(s1.endsWith("/")){
+                                    s2=s1.substring(0,s1.length()-1);
+                                }else s2=s1;
+                                String[] split = str.split("/");
+                                Optional<User> first;
+                                Integer exception=null;
+                                if(split.length==1){
+                                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                                        Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(split[0])).findFirst();
+                                        first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
+                                    }else {
+                                        first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
+                                    }
+                                    exception=0;
+                                }else {
+                                    if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                                        Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(split[1])).findFirst();
+                                        first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
+                                        exception=1;
+                                    }else {
+                                        first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
+                                    }
+                                }
+                                if (first.isPresent()) {
+                                    User partMemb = first.get();
 //                                    System.out.println("参与人:"+partMemb.getName());
                                     if (!projectAuditorList.stream().anyMatch(partOne->partOne.getAuditorId().equals(partMemb.getId()))) {
                                         projectAuditor.setAuditorId(partMemb.getId());

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/application.yml

@@ -15,7 +15,7 @@ spring:
       location: C:/upload/
   datasource:
     driver-class-name: com.mysql.cj.jdbc.Driver
-    url: jdbc:mysql://47.101.180.183:3306/man_hour_manager?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&useSSL=false
+    url: jdbc:mysql://47.101.180.183:3306/man_dev?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&useSSL=false
     username: root
     password: HuoshiDB@2022
 #    url: jdbc:mysql://127.0.0.1:3306/man_hour_manager?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&rewriteBatchedStatements=true&useSSL=false