Browse Source

异常工时提醒

QuYueTing 1 tuần trước cách đây
mục cha
commit
6b9b2c0574

+ 17 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -10870,15 +10870,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         List<Map<String, Object>> data = getReportTimeLessThanCardTimeList(startDate, endDate, null,null, companyId, true);
         if (data.size() > 0) {
             //发送企业微信消息提醒,给员工和系统管理员
-            List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+            List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).in("id", data.stream().map(m -> String.valueOf(m.get("userId"))).collect(Collectors.toList())));
             WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
             String wxUserIds = userList.stream().map(User::getCorpwxUserid).collect(Collectors.joining("|"));
             wxCorpInfoService.sendWXCorpMsg(wxCorpInfo, wxUserIds,  "您最近一周内考勤工时填报存在异常,请及时修正!", null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_ABNOEMAL);
 
-//            for (Map<String, Object> map : data) {
-//                String userId = String.valueOf(map.get("userId"));
-//                String userName = String.valueOf(map.get("userName"));
-//                }
             //给管理员发送
             List<User> adminList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).eq("role_name", "系统管理员"));
             String adminIds = adminList.stream().map(User::getCorpwxUserid).collect(Collectors.joining("|"));
@@ -11023,8 +11019,22 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 }
             }
         }
-
-
+        //去掉不提醒的人员
+        for (int i=0;i<manageUserList.size();i++) {
+            User item = manageUserList.get(i);
+            //不需要填报的用户,需要去掉
+            if (item.getReportStatus() == 1) {
+                manageUserList.remove(item);
+                i--;
+                if (timeType.getSyncCorpwxTime() == 1) {
+                    //从userCorpwxTimeList中去掉
+                    userCorpwxTimeList.removeIf(userCorpwxTime -> userCorpwxTime.getCorpwxUserid() != null && userCorpwxTime.getCorpwxUserid().equals(item.getCorpwxUserid()));
+                } else if (timeType.getSyncFanwei() == 1) {
+                    //从userFvTimeList中去掉
+                    userFvTimeList.removeIf(userFvTime -> userFvTime.getUserId() != null && userFvTime.getUserId().equals(item.getId()));
+                }
+            }
+        }
 
         //获取填报工时记录表
         List<Report> reportList = new ArrayList<>();