|
@@ -3188,9 +3188,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
userNameList.add(inchargerName);
|
|
|
}
|
|
|
}
|
|
|
- System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
|
HttpRespMsg respMsg=new HttpRespMsg();
|
|
|
- if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
|
+ if(userNameList.size() > 0 && wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
|
|
|
+ System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
|
|
|
respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
|
|
|
if(respMsg.code.equals("0")){
|
|
|
msg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
|
|
@@ -3386,44 +3386,51 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
List<Participation> participationList = new ArrayList<>();
|
|
|
if(inchargerCell!=null){
|
|
|
- String value = inchargerCell.getStringCellValue();
|
|
|
- String s1;
|
|
|
- if(value.startsWith("/")){
|
|
|
- s1=value.substring(1,value.length());
|
|
|
- }else s1=value;
|
|
|
- String s2;
|
|
|
- if(s1.endsWith("/")){
|
|
|
- s2=s1.substring(0,s1.length()-1);
|
|
|
- }else s2=s1;
|
|
|
- String[] split = s2.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();
|
|
|
+ String value = inchargerCell.getStringCellValue().trim();
|
|
|
+ if (!StringUtils.isEmpty(value)) {
|
|
|
+ //有项目经理
|
|
|
+ String s1;
|
|
|
+ if(value.startsWith("/")){
|
|
|
+ s1=value.substring(1,value.length());
|
|
|
}else {
|
|
|
- first= userList.stream().filter(u -> u.getName().equals(split[0])||(u.getJobNumber()!=null&&u.getJobNumber().equals(split[0]))).findFirst();
|
|
|
+ s1=value;
|
|
|
}
|
|
|
- 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;
|
|
|
+ String s2;
|
|
|
+ if(s1.endsWith("/")){
|
|
|
+ s2=s1.substring(0,s1.length()-1);
|
|
|
}else {
|
|
|
- first= userList.stream().filter(u -> u.getName().equals(split[0])&&(u.getJobNumber()!=null&&u.getJobNumber().equals(split[1]))).findFirst();
|
|
|
+ s2=s1;
|
|
|
}
|
|
|
- }
|
|
|
- Participation p = new Participation();
|
|
|
- if (first.isPresent()) {
|
|
|
- p.setUserId(first.get().getId());
|
|
|
- p.setProjectId(project.getId());
|
|
|
- participationList.add(p);
|
|
|
- } else {
|
|
|
- switch (exception){
|
|
|
- case 0:throw new Exception("["+split[0]+"]在系统中不存在");
|
|
|
- case 1:throw new Exception("["+split[0]+"]在系统中不存在");
|
|
|
+ String[] split = s2.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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Participation p = new Participation();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ p.setUserId(first.get().getId());
|
|
|
+ p.setProjectId(project.getId());
|
|
|
+ participationList.add(p);
|
|
|
+ } else {
|
|
|
+ switch (exception){
|
|
|
+ case 0:throw new Exception("["+split[0]+"]在系统中不存在");
|
|
|
+ case 1:throw new Exception("["+split[0]+"]在系统中不存在");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|