| | |
| | | } |
| | | } |
| | | |
| | | public int syncUsersToQwStaff() throws IOException { |
| | | List<WorkWXUser> userList = getUserList(); |
| | | |
| | | if (userList == null || userList.isEmpty()) { |
| | | log.warn("获取到的用户列表为空"); |
| | | return 0; |
| | | } |
| | | |
| | | int insertCount = 0; |
| | | for (WorkWXUser user : userList) { |
| | | if (user.getUserid() == null || user.getUserid().isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | qwStaffMapper.delete( |
| | | new LambdaQueryWrapper<QwStaff>().eq(QwStaff::getAccount, user.getUserid()) |
| | | ); |
| | | |
| | | QwStaff qwStaff = new QwStaff(); |
| | | qwStaff.setName(user.getName()); |
| | | qwStaff.setAccount(user.getUserid()); |
| | | qwStaff.setDept(user.getDepartment() != null ? user.getDepartment().toString() : null); |
| | | |
| | | qwStaffMapper.insert(qwStaff); |
| | | insertCount++; |
| | | } |
| | | |
| | | log.info("同步用户到QW_STAFF表完成,同步用户数: {}", insertCount); |
| | | return insertCount; |
| | | } |
| | | |
| | | public List<CheckinData> getCheckinData(long startTime, long endTime, List<String> useridList) throws IOException { |
| | | String accessToken = getAccessToken(); |
| | | String url = String.format("https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata?access_token=%s", accessToken); |