ソースを参照

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 1 年間 前
コミット
416c3309c1

+ 14 - 2
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsServiceImpl.java

@@ -86,15 +86,27 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
         String token = String.valueOf(request.getHeader("Token"));
         User user = userMapper.selectById(token);
         Integer companyId = user.getCompanyId();
+        if (StringUtils.isEmpty(contacts.getName())){
+            httpRespMsg.setError("请输入联系人姓名");
+        }
+        if (contacts.getCustomId()==null){
+            httpRespMsg.setError("客户信息为空");
+        }
+        if (StringUtils.isEmpty(contacts.getPhone())){
+            httpRespMsg.setError("联系人电话号码为空");
+        }
         if (contacts.getOwnerId() == null) {
             httpRespMsg.setError("负责人信息为空!");
         }
 
         LambdaQueryWrapper<Contacts> lqw_contacts = new LambdaQueryWrapper<>();
-        lqw_contacts.eq(Contacts::getCustomId, contacts.getCustomId()).eq(Contacts::getName, contacts.getName());
+        lqw_contacts.eq(Contacts::getCustomId, contacts.getCustomId())
+                .eq(Contacts::getName, contacts.getName())
+                .eq(Contacts::getPhone,contacts.getPhone())
+                .eq(Contacts::getOwnerId,contacts.getOwnerId());
         Contacts selectedOne = contactsMapper.selectOne(lqw_contacts);
         if (selectedOne != null) {
-            httpRespMsg.setError("已存在该客户!");
+            httpRespMsg.setError("已存在该联系人!");
         }
         contacts.setCompanyId(companyId)
                 //todo:联系人的所有人是可选择的

+ 77 - 28
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -39,6 +39,8 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 /**
@@ -307,18 +309,27 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                     if(cell!=null){
                         switch (item.getString("type")){
                             case "time":cell.setCellType(CellType.NUMERIC);
+                                System.out.println(cell.getNumericCellValue());
                                 break;
                             case "int":cell.setCellType(CellType.NUMERIC);
                                 break;
                             default:cell.setCellType(CellType.STRING);
                         }
                     }
-                    if(modelName.equals("inchargerId")){
-                        if(!org.springframework.util.StringUtils.isEmpty(cell.getStringCellValue())){
-                            userNameList.add(cell.getStringCellValue());
+                    if(modelName.equals("executorId")){
+                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                            List<String> executorNames = new ArrayList<>();
+                            String stringCellValue = cell.getStringCellValue();
+                            // 定义正则表达式,匹配中文字符、英文字符、数字
+                            Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5a-zA-Z0-9]+");
+                            Matcher matcher = pattern.matcher(stringCellValue);
+                            while (matcher.find()) {
+                                // 将匹配到的部分添加到人名列表中
+                                executorNames.add(matcher.group());
+                            }
+                            userNameList.addAll(executorNames);
                         }
                     }
-
                 }
             }
 
@@ -357,6 +368,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                     if(cell!=null){
                         switch (item.getString("type")){
                             case "time":cell.setCellType(CellType.NUMERIC);
+                                System.out.println(cell.getNumericCellValue());
                                 break;
                             case "int":cell.setCellType(CellType.NUMERIC);
                                 break;
@@ -386,21 +398,39 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                             }
                         }
                     }*/
-                    if(modelName.equals("inchargerId")){
+                    if(modelName.equals("executorId")){
                         if(!StringUtils.isEmpty(cell.getStringCellValue())){
-                            String userName = cell.getStringCellValue();
-                            Optional<User> first;
-                            if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                                Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(userName)).findFirst();
-                                first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
-                            }else {
-                                first= userList.stream().filter(u -> u.getName().equals(userName)||(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))).findFirst();
+
+                            List<String> executorNames = new ArrayList<>();
+                            String stringCellValue = cell.getStringCellValue();
+                            // 定义正则表达式,匹配中文字符、英文字符、数字
+                            Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5a-zA-Z0-9]+");
+                            Matcher matcher = pattern.matcher(stringCellValue);
+                            while (matcher.find()) {
+                                // 将匹配到的部分添加到人名列表中
+                                executorNames.add(matcher.group());
+                            }
+
+                            ArrayList<String> executorIds = new ArrayList<>();
+                            for (String userName : executorNames) {
+                                Optional<User> first;
+                                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                                    Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(userName)).findFirst();
+                                    first= userList.stream().filter(u ->(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))||(optional.isPresent()&&u.getCorpwxUserid()!=null&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
+                                }else {
+                                    first= userList.stream().filter(u -> u.getName().equals(userName)||(u.getJobNumber()!=null&&u.getJobNumber().equals(userName))).findFirst();
+                                }
+                                if (first.isPresent()) {
+                                  executorNames.add(first.get().getId());
+                                } else {
+                                    throw new Exception("["+userName+"]在系统中不存在");
+                                }
                             }
-                            if (first.isPresent()) {
-                                task.setOwnerId(first.get().getId());
-                            } else {
-                                throw new Exception("["+userName+"]在系统中不存在");
+                            StringJoiner joiner = new StringJoiner(",");
+                            for (String executorId : executorIds) {
+                                joiner.add(executorId);
                             }
+                            task.setExecutorId(joiner.toString()==null?"":joiner.toString());
                         }
                     }
                     /*if(cell.getCellType()==CellType.STRING.getCode()&&!StringUtils.isEmpty(cell.getStringCellValue())){
@@ -409,19 +439,38 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
 
 
                     }*/
-                    if (cell != null && cell.getCellTypeEnum() != CellType.BLANK) {
-                        if (cell.getCellTypeEnum() == CellType.STRING && cell.getStringCellValue() != null && !cell.getStringCellValue().isEmpty()) {
-                            // 字符串类型不为空
-                            method.invoke(task,cell.getStringCellValue());
-                        } else if (cell.getCellTypeEnum() == CellType.NUMERIC) {
-                            // 数值类型不为空
-                            double numericCellValue = cell.getNumericCellValue();
-                            if (type.getSimpleName().equals("Integer")){
-                                int intValue = (int) numericCellValue;
-                                method.invoke(task,intValue);
+                    if(modelName.equals("taskName")){
+                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                            task.setTaskName(cell.getStringCellValue());
+                        }
+                    }
+                    if(modelName.equals("priority")){
+                        if(!StringUtils.isEmpty(cell.getStringCellValue())){
+                            switch (cell.getStringCellValue()){
+                                case "底":task.setStatus(0);
+                                    break;
+                                case "中":task.setStatus(1);
+                                    break;
+                                case "高":task.setStatus(2);
+                                    break;
+                            }
+                        }
+                    }
+                    if(modelName.equals("startDate")){
+                        if(cell != null && cell.getCellTypeEnum() != CellType.BLANK){
+                            if (cell.getCellTypeEnum() == CellType.NUMERIC){
+                                double numericCellValue = cell.getNumericCellValue();
+                                long daysSince1900 = (long) numericCellValue - 2;
+                                task.setStartDate(LocalDate.of(1900, 1, 1).plusDays(daysSince1900));
                             }
-                            else {
-                                method.invoke(task, numericCellValue);
+                        }
+                    }
+                    if(modelName.equals("endDate")){
+                        if(cell != null && cell.getCellTypeEnum() != CellType.BLANK){
+                            if (cell.getCellTypeEnum() == CellType.NUMERIC){
+                                double numericCellValue = cell.getNumericCellValue();
+                                long daysSince1900 = (long) numericCellValue - 2;
+                                task.setEndDate(LocalDate.of(1900, 1, 1).plusDays(daysSince1900));
                             }
                         }
                     }