Browse Source

企业微信同步的时候,不修改已经同步过来的人员部门;
修复任务导入Bug

seyason 1 year ago
parent
commit
e5cfc74b0a

+ 6 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -2420,16 +2420,19 @@ public class WeiXinCorpController {
                         changeUser.setName(userItem.getName());
                     }
                     if (!userItem.getCorpwxDeptid().equals(oldUser.getCorpwxDeptid())) {
-                        changeUser.setId(oldUser.getId());
                         if (userItem.getCorpwxDeptid() != 1) {
+                            changeUser.setId(oldUser.getId());
                             changeUser.setDepartmentId(allDeptList.stream().filter(d->d.getCorpwxDeptid() != null && d.getCorpwxDeptid().equals(userItem.getCorpwxDeptid())).findFirst().get().getDepartmentId());
                             //设置层级部门
                             changeUser.setDepartmentCascade(convertDepartmentIdToCascade(changeUser.getDepartmentId(), allDeptList));
-                        } else {
+                            changeUser.setCorpwxDeptid(userItem.getCorpwxDeptid());
+                        } else if (oldUser.getCorpwxDeptid() == 1) {
+                            changeUser.setId(oldUser.getId());
+                            //从待分配变成有部门的时候才更新;避免原来有部门的被冲掉,变成无部门
                             changeUser.setDepartmentId(0);
                             changeUser.setDepartmentCascade("0");
+                            changeUser.setCorpwxDeptid(userItem.getCorpwxDeptid());
                         }
-                        changeUser.setCorpwxDeptid(userItem.getCorpwxDeptid());
                     }
                     if (oldUser.getCorpwxRealUserid() == null || !userItem.getCorpwxRealUserid().equals(oldUser.getCorpwxRealUserid())) {
                         changeUser.setId(oldUser.getId());

+ 12 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -461,7 +461,9 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
             }
             System.out.println("参与搜素的人员列表"+userNameList + userNameList.size());
             HttpRespMsg respMsg=new HttpRespMsg();
+            boolean isCorpWxUser = false;
             if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1&&userNameList.size()>0){
+                isCorpWxUser = true;
                 respMsg = wxCorpInfoService.getBatchSearchUserInfo(wxCorpInfo, userNameList,null);
                 if(respMsg.code.equals("0")){
                     httpRespMsg.setError("姓名为["+String.valueOf(respMsg.data)+"]的人员存在重复,请使用工号!");
@@ -514,8 +516,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                     String executorColorString="";
                     for (int i=0;i<executorNameList.size();i++) {
                         String executorName = executorNameList.get(i);
-                        Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(executorName)).findFirst();
-                        Optional<User> first = allUserList.stream().filter(u ->optional.isPresent()&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid())).findFirst();
+                        Optional<User> first = null;
+                        if (isCorpWxUser) {
+                            Optional<User> optional = targetUserList.stream().filter(tl -> tl.getName().equals(executorName)).findFirst();
+                            first = allUserList.stream().filter(u->(optional.isPresent()&&u.getCorpwxUserid().equals(optional.get().getCorpwxUserid()))).findFirst();
+                        } else {
+                            first = allUserList.stream().filter(u ->u.getName().equals(executorName)).findFirst();
+                        }
+
                         if (first.isPresent()) {
                             User find = first.get();
                             if(i==executorNameList.size()-1){
@@ -559,14 +567,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
                 if(levelCell!=null){
                     task.setTaskLevel(taskLevelMap.get(levelCell.getStringCellValue()));
                 }
-                if(startDateCell.getDateCellValue()!=null){
+                if(startDateCell != null && startDateCell.getDateCellValue()!=null){
                     Date dateCellValue = startDateCell.getDateCellValue();
                     System.out.println("日期=="+dateCellValue.toString());
                     String formatValue = new SimpleDateFormat("yyyy-MM-dd").format(dateCellValue);
                     LocalDate startDate = LocalDate.parse(formatValue, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
                     task.setStartDate(startDate);
                 }
-                if(endDateCell.getDateCellValue()!=null){
+                if(endDateCell != null && endDateCell.getDateCellValue()!=null){
                     Date dateCellValue = endDateCell.getDateCellValue();
                     System.out.println("日期=="+dateCellValue.toString());
                     String formatValue = new SimpleDateFormat("yyyy-MM-dd").format(dateCellValue);

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -516,7 +516,8 @@ public class TimingTask {
                     leaveSheet.setLeaveType(leaveType);
                     leaveSheet.setProcinstId(String.valueOf(map.get("id")));
                     leaveSheet.setGmtFinished(String.valueOf(map.get("gmtFinished")));
-                    Optional<LeaveSheet> first = oldLeaveSheetList.stream().filter(ol -> ol.getStartDate().isEqual(leaveSheet.getStartDate())&&ol.getEndDate().isEqual(leaveSheet.getEndDate())&& ol.getOwnerId().equals(leaveSheet.getOwnerId())&&(ol.getProcinstId()!=null&& ol.getProcinstId().equals(leaveSheet.getProcinstId()))).findFirst();
+                    //看看是否已经存在:同一个人,同一段时间,同样的请假时长则视为同一条记录
+                    Optional<LeaveSheet> first = oldLeaveSheetList.stream().filter(ol -> ol.getStartDate().isEqual(leaveSheet.getStartDate())&&ol.getEndDate().isEqual(leaveSheet.getEndDate())&& ol.getOwnerId().equals(leaveSheet.getOwnerId())&&ol.getTimeHours().equals(leaveSheet.getTimeHours())).findFirst();
                     if(first.isPresent()){
                         leaveSheet.setId(first.get().getId());
                     }

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

@@ -146,7 +146,7 @@ referer:
     - mldmobworktime.ttkuaiban.com
     - mldworktime.ttkuaiban.com
     - 47.101.180.183
-excludeUrls: /wxcorp/*,/wxcorp/*/*,/dingding/*,/feishu-info/*,/error,/testClient,/corpWXAuth,/corpWXScanningAuth,/corpInsideWXAuth,/wx-corp-info/*,/clean/*,/innerRoles/*,/project/getProjectListByToken,/project/getTimeCostByToken,/report/getReportListByToken,/report/getProcessErrorData,/project/synchronizationProject,/user/updateUserDeptHierarchy
+excludeUrls: /wxcorp/*,/wxcorp/*/*,/dingding/*,/feishu-info/*,/error,/testClient,/corpWXAuth,/corpWXScanningAuth,/corpInsideWXAuth,/wx-corp-info/*,/clean/*,/innerRoles/*,/project/getProjectListByToken,/project/getTimeCostByToken,/report/getReportListByToken,/report/getProcessErrorData,/project/synchronizationProject,/user/updateUserDeptHierarchy,/report/getUserTimeCostByThird,/report/getProjectTimeCostByThird
 
 #企业微信相关参数
 suitId: ww4e237fd6abb635af

+ 18 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/Login.vue

@@ -151,6 +151,9 @@
                         } else {
                             if(user.moduleList.length > 0) {
                                 this.$router.push({ path: user.moduleList[0].path })
+                            } else {
+                                //没有授权任何模块,需要提示用户
+                                alert('无权访问,请联系管理员为您分配权限');
                             }
                         }
                     } else if (href.indexOf('errorMsg=') > 0) {
@@ -183,6 +186,9 @@
                     } else {
                         if(user.moduleList.length > 0) {
                             this.$router.push({ path: user.moduleList[0].path })
+                        } else {
+                            //没有授权任何模块,需要提示用户
+                            alert('无权访问,请联系管理员为您分配权限');
                         }
                     }
                 } else {
@@ -368,6 +374,9 @@
                                         var newHref = location.href.split("?")[0] + '#' + (path.indexOf('/')>-1?path:('/'+path));
                                         location.href = newHref;
                                     }
+                                } else {
+                                    //没有授权任何模块,需要提示用户
+                                    alert('无权访问,请联系管理员为您分配权限');
                                 }
                             } else {
                                 this.$message({
@@ -394,6 +403,9 @@
                                     this.$router.push({ path: jumpurl })
                                 }else if(user.moduleList.length > 0) {
                                     this.$router.push({ path: user.moduleList[0].path })
+                                }else {
+                                    //没有授权任何模块,需要提示用户
+                                    alert('无权访问,请联系管理员为您分配权限');
                                 }
                             } else {
                                 this.$message({
@@ -498,6 +510,9 @@
                             if(user.moduleList.length > 0) {
                                 this.$router.push({ path: user.moduleList[0].path })
                                 sessionStorage.setItem('autoRoute',user.moduleList[0].path)
+                            } else {
+                                //没有授权任何模块,需要提示用户
+                                alert('无权访问,请联系管理员为您分配权限');
                             }
                         }
                     } else {
@@ -527,6 +542,9 @@
                         this.permissionsList(res.data)
                         if(user.moduleList.length > 0) {
                             this.$router.push({ path: user.moduleList[0].path })
+                        } else {
+                            //没有授权任何模块,需要提示用户
+                            alert('无权访问,请联系管理员为您分配权限');
                         }
                     } else {
                         this.$message({