Parcourir la source

考勤时长的匹配,针对corpwx_userid为Null的情况使用姓名匹配

seyason il y a 9 mois
Parent
commit
75304c6d2a

+ 9 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -1716,14 +1716,21 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     for (Map map : nameList) {
                         String corpwxUserid = (String)map.get("corpwxUserid");
                         String dateStr = (String)map.get("dateStr");
-                        userCorpwxTimeQueryWrapper.or(wrapper->wrapper.eq("corpwx_userid", corpwxUserid).eq("create_date", dateStr));
+                        String name = (String)map.get("name");
+                        if (corpwxUserid != null) {
+                            userCorpwxTimeQueryWrapper.or(wrapper->wrapper.eq("corpwx_userid", corpwxUserid).eq("create_date", dateStr));
+                        } else {
+                            userCorpwxTimeQueryWrapper.or(wrapper->wrapper.eq("name", name).eq("create_date", dateStr));
+                        }
+
                     }
                     List<UserCorpwxTime> timeList = userCorpwxTimeMapper.selectList(userCorpwxTimeQueryWrapper);
                     //过滤匹配当前的数据
                     for (Map map : nameList) {
                         String corpwxUserid = (String)map.get("corpwxUserid");
+                        String name = (String)map.get("name");
                         String dateStr = (String)map.get("dateStr");
-                        Optional<UserCorpwxTime> first = timeList.stream().filter(time -> time.getCorpwxUserid().equals(corpwxUserid) && dtf.format(time.getCreateDate()).equals(dateStr)).findFirst();
+                        Optional<UserCorpwxTime> first = timeList.stream().filter(time -> ((time.getCorpwxUserid() != null && time.getCorpwxUserid().equals(corpwxUserid)) || (time.getCorpwxUserid() == null && name != null && name.equals(time.getName()))) && dtf.format(time.getCreateDate()).equals(dateStr)).findFirst();
                         if (first.isPresent()) {
                             double wh = first.get().getWorkHours();
                             //赋值打卡时长