Browse Source

增加tag获取

xueyiming 2 months ago
parent
commit
3ebe34472c

+ 17 - 1
offline-module/src/main/java/com/tzld/piaoquan/offline/job/WeComUserDataJob.java

@@ -245,7 +245,7 @@ public class WeComUserDataJob {
     }
 
     @XxlJob("statisticsUserCountJob")
-    public ReturnT<String> statisticsUserCount(String param) throws IOException {
+    public ReturnT<String> statisticsUserCount(String param) {
         StaffExample staffExample = new StaffExample();
         List<Staff> staffList = staffMapper.selectByExample(staffExample);
         String date;
@@ -309,6 +309,22 @@ public class WeComUserDataJob {
                     count++;
                     Long userId = weComUserMapper.selectIdByExternalUserId(externalUserId);
                     userId = addAndUpdateUser(externalContact, corpId, externalUserId, createAt, staff.getId(), userId);
+                    JSONArray tagIds = followInfo.getJSONArray("tag_id");
+                    if (!CollectionUtils.isEmpty(tagIds)) {
+                        List<String> tagIdList = tagIds.toJavaList(String.class);
+                        for (String tagId : tagIdList) {
+                            TagExample example = new TagExample();
+                            example.createCriteria().andTagIdEqualTo(tagId);
+                            List<Tag> tags = tagMapper.selectByExample(example);
+                            if (!CollectionUtils.isEmpty(tags)) {
+                                Tag tag = tags.get(0);
+                                UserWithTag userWithTag = new UserWithTag();
+                                userWithTag.setUserId(userId);
+                                userWithTag.setTagId(tag.getId());
+                                addUserWithTag(userWithTag);
+                            }
+                        }
+                    }
                 }
                 String nextCursor = jsonObject.getString("next_cursor");
                 if (cursor.equals(nextCursor)) {