tjx
5 天以前 56ae62dd364b2822016b1b25208133e9177cfae1
src/main/java/com/gs/dingtalk/service/WorkWXService.java
@@ -212,6 +212,39 @@
        }
    }
    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;
            }
            QwStaff existingStaff = qwStaffMapper.selectOne(
                new LambdaQueryWrapper<QwStaff>().eq(QwStaff::getAccount, user.getUserid())
            );
            if (existingStaff == null) {
                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);