Browse Source

社群 群、好友状态同步

wangyunpeng 4 days ago
parent
commit
c871f5171a
15 changed files with 583 additions and 193 deletions
  1. 2 0
      api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ext/ThirdPartWeComMapperExt.java
  2. 48 27
      api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComUserDetailJob.java
  3. 11 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComRoom.java
  4. 60 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComRoomExample.java
  5. 11 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComRoomUser.java
  6. 60 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComRoomUserExample.java
  7. 11 11
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComStaff.java
  8. 70 70
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComStaffExample.java
  9. 22 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComStaffUser.java
  10. 120 0
      api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComStaffUserExample.java
  11. 25 7
      api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComRoomMapper.xml
  12. 25 8
      api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComRoomUserMapper.xml
  13. 20 20
      api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComStaffMapper.xml
  14. 52 19
      api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComStaffUserMapper.xml
  15. 46 31
      api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComMapperExt.xml

+ 2 - 0
api-module/src/main/java/com/tzld/piaoquan/api/dao/mapper/wecom/thirdpart/ext/ThirdPartWeComMapperExt.java

@@ -13,4 +13,6 @@ public interface ThirdPartWeComMapperExt {
     void batchInsertThirdPartWeComStaffUser(@Param("records") List<ThirdPartWeComStaffUser> saveList);
 
     List<ThirdPartWeComStaffUser> getNoGroupStaffUserList(@Param("thirdStaffId") Long thirdStaffId);
+
+    void setRoomUserQuitTime(@Param("thirdRoomId") String thirdRoomId, @Param("deleteList") List<Long> deleteList, @Param("quitTime") Long quitTime);
 }

+ 48 - 27
api-module/src/main/java/com/tzld/piaoquan/api/job/wecom/thirdpart/WeComUserDetailJob.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.TypeReference;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import com.tzld.piaoquan.api.component.WeComThirdPartyApiClient;
-import com.tzld.piaoquan.api.model.param.wecom.thirdpart.GetRoomUserListResponse;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComRoomMapper;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComRoomUserMapper;
 import com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ThirdPartWeComStaffMapper;
@@ -114,38 +113,48 @@ public class WeComUserDetailJob {
                 .collect(Collectors.toMap(ThirdPartWeComStaffUser::getUserId, user -> user));
         List<ThirdPartWeComStaffUser> saveList = new ArrayList<>();
         for (ExternalContactsResponse.ContactItem contactItem : contactItemList) {
-            //if (existUserIdList.contains(contactItem.getUser_id())) {
-            //    ThirdPartWeComStaffUser existUser = existUserMap.get(contactItem.getUser_id());
-            //    existUser.setUpdateTime(new Date());
-            //
-            //    existUser.setUnionid(contactItem.getUnionid());
-            //    existUser.setSex(contactItem.getSex());
-            //    existUser.setMobile(contactItem.getMobile());
-            //    existUser.setCompanyRemark(contactItem.getCompany_remark());
-            //    existUser.setAcctid(contactItem.getAcctid());
-            //    existUser.setAvatar(contactItem.getAvatar());
-            //    existUser.setSource(contactItem.getSource());
-            //    existUser.setEnglishName(contactItem.getEnglish_name());
-            //    existUser.setRemarkPhone(JSONObject.toJSONString(contactItem.getRemark_phone()));
-            //    existUser.setRealname(contactItem.getRealname());
-            //    existUser.setRealRemarks(contactItem.getReal_remarks());
-            //    existUser.setLabelid(JSONObject.toJSONString(contactItem.getLabelid()));
-            //    existUser.setUserId(contactItem.getUser_id());
-            //    existUser.setNickname(contactItem.getNickname());
-            //    existUser.setPosition(contactItem.getPosition());
-            //    existUser.setCorpId(contactItem.getCorp_id());
-            //    existUser.setSeq(contactItem.getSeq());
-            //    existUser.setStatus(contactItem.getStatus());
-            //
-            //    staffUserMapper.updateByPrimaryKeySelective(existUser);
-            //} else {
-            if (!existUserIdList.contains(contactItem.getUser_id())) {
+            if (existUserIdList.contains(contactItem.getUser_id())) {
+                //0 互相删除 8主动删除拉黑  2049被删除  其他的都是好友
+                List<Integer> deleteStatusList = Arrays.asList(0, 8, 2049);
+                ThirdPartWeComStaffUser existUser = existUserMap.get(contactItem.getUser_id());
+                existUser.setUpdateTime(new Date());
+                if (deleteStatusList.contains(contactItem.getStatus())
+                        && !deleteStatusList.contains(existUser.getStatus())) {
+                    existUser.setRemoveCustiomerTime(System.currentTimeMillis() / 1000);
+                } else if (deleteStatusList.contains(contactItem.getStatus())
+                        && Objects.isNull(existUser.getRemoveCustiomerTime())) {
+                    // 历史已删除,设为前一天
+                    existUser.setRemoveCustiomerTime((System.currentTimeMillis() / 1000) - 86400);
+                }
+                existUser.setAddCustomerTime(contactItem.getAdd_customer_time());
+                existUser.setUnionid(contactItem.getUnionid());
+                existUser.setSex(contactItem.getSex());
+                existUser.setMobile(contactItem.getMobile());
+                existUser.setCompanyRemark(contactItem.getCompany_remark());
+                existUser.setAcctid(contactItem.getAcctid());
+                existUser.setAvatar(contactItem.getAvatar());
+                existUser.setSource(contactItem.getSource());
+                existUser.setEnglishName(contactItem.getEnglish_name());
+                existUser.setRemarkPhone(JSONObject.toJSONString(contactItem.getRemark_phone()));
+                existUser.setRealname(contactItem.getRealname());
+                existUser.setRealRemarks(contactItem.getReal_remarks());
+                existUser.setLabelid(JSONObject.toJSONString(contactItem.getLabelid()));
+                existUser.setUserId(contactItem.getUser_id());
+                existUser.setNickname(contactItem.getNickname());
+                existUser.setPosition(contactItem.getPosition());
+                existUser.setCorpId(contactItem.getCorp_id());
+                existUser.setSeq(contactItem.getSeq());
+                existUser.setStatus(contactItem.getStatus());
+
+                staffUserMapper.updateByPrimaryKeySelective(existUser);
+            } else {
                 ThirdPartWeComStaffUser staffUser = new ThirdPartWeComStaffUser();
                 staffUser.setThirdStaffId(thirdStaffId);
                 staffUser.setCreateTime(new Date());
                 staffUser.setUpdateTime(new Date());
 
                 // 从ContactItem对象复制所有字段值
+                staffUser.setAddCustomerTime(contactItem.getAdd_customer_time());
                 staffUser.setUnionid(contactItem.getUnionid());
                 staffUser.setSex(contactItem.getSex());
                 staffUser.setMobile(contactItem.getMobile());
@@ -221,6 +230,7 @@ public class WeComUserDetailJob {
                 roomDetail.setName(roomInfo.getNickname());
                 roomDetail.setAddUserStatus(0);
                 roomDetail.setSendStatus(0);
+                roomDetail.setRoomCreateTime(roomInfo.getCreate_time());
                 roomDetail.setCreateTime(new Date());
                 roomDetail.setUpdateTime(new Date());
                 roomMapper.insertSelective(roomDetail);
@@ -230,6 +240,7 @@ public class WeComUserDetailJob {
                 roomDetail.setThirdCreateUserId(roomInfo.getCreate_user_id());
                 roomDetail.setMemberCount(roomInfo.getTotal());
                 roomDetail.setName(roomInfo.getNickname());
+                roomDetail.setRoomCreateTime(roomInfo.getCreate_time());
                 roomDetail.setUpdateTime(new Date());
                 if (staff.getAutoCreateRoom() == 1) {
                     if (roomDetail.getMemberCount() >= memberMaxNums) {
@@ -257,6 +268,7 @@ public class WeComUserDetailJob {
     public void syncRoomUserList(String uuid, String thirdRoomId) {
         GetRoomUserListRequest request = new GetRoomUserListRequest(uuid, Long.valueOf(thirdRoomId));
         List<GetRoomUserListResponse.Member> userList = thirdPartyService.getRoomUserList(request);
+        List<Long> currentUniList = userList.stream().map(GetRoomUserListResponse.Member::getUin).collect(Collectors.toList());
         List<ThirdPartWeComRoomUser> existUserList = getThirdPartWeComRoomUserListByRoomId(thirdRoomId);
         List<Long> existUserIdList = existUserList.stream().map(ThirdPartWeComRoomUser::getUin).collect(Collectors.toList());
         Map<Long, ThirdPartWeComRoomUser> existUserMap = existUserList.stream()
@@ -316,6 +328,15 @@ public class WeComUserDetailJob {
         if (CollectionUtils.isNotEmpty(saveList)) {
             thirdPartWeComMapperExt.batchInsertThirdPartWeComRoomUser(saveList);
         }
+        // 删除不存在的用户
+        List<Long> deleteList = existUserList.stream()
+                .map(ThirdPartWeComRoomUser::getUin)
+                .filter(uin -> !currentUniList.contains(uin))
+                .collect(Collectors.toList());
+        if (CollectionUtils.isNotEmpty(deleteList)) {
+            Long quitTime = System.currentTimeMillis() / 1000;
+            thirdPartWeComMapperExt.setRoomUserQuitTime(thirdRoomId, deleteList, quitTime);
+        }
     }
 
     private List<ThirdPartWeComRoomUser> getThirdPartWeComRoomUserListByRoomId(String thirdRoomId) {

+ 11 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComRoom.java

@@ -19,6 +19,8 @@ public class ThirdPartWeComRoom {
 
     private String roomUrl;
 
+    private Long roomCreateTime;
+
     private Integer addUserStatus;
 
     private Integer sendStatus;
@@ -95,6 +97,14 @@ public class ThirdPartWeComRoom {
         this.roomUrl = roomUrl;
     }
 
+    public Long getRoomCreateTime() {
+        return roomCreateTime;
+    }
+
+    public void setRoomCreateTime(Long roomCreateTime) {
+        this.roomCreateTime = roomCreateTime;
+    }
+
     public Integer getAddUserStatus() {
         return addUserStatus;
     }
@@ -157,6 +167,7 @@ public class ThirdPartWeComRoom {
         sb.append(", memberCount=").append(memberCount);
         sb.append(", name=").append(name);
         sb.append(", roomUrl=").append(roomUrl);
+        sb.append(", roomCreateTime=").append(roomCreateTime);
         sb.append(", addUserStatus=").append(addUserStatus);
         sb.append(", sendStatus=").append(sendStatus);
         sb.append(", sendTime=").append(sendTime);

+ 60 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComRoomExample.java

@@ -626,6 +626,66 @@ public class ThirdPartWeComRoomExample {
             return (Criteria) this;
         }
 
+        public Criteria andRoomCreateTimeIsNull() {
+            addCriterion("room_create_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeIsNotNull() {
+            addCriterion("room_create_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeEqualTo(Long value) {
+            addCriterion("room_create_time =", value, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeNotEqualTo(Long value) {
+            addCriterion("room_create_time <>", value, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeGreaterThan(Long value) {
+            addCriterion("room_create_time >", value, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeGreaterThanOrEqualTo(Long value) {
+            addCriterion("room_create_time >=", value, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeLessThan(Long value) {
+            addCriterion("room_create_time <", value, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeLessThanOrEqualTo(Long value) {
+            addCriterion("room_create_time <=", value, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeIn(List<Long> values) {
+            addCriterion("room_create_time in", values, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeNotIn(List<Long> values) {
+            addCriterion("room_create_time not in", values, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeBetween(Long value1, Long value2) {
+            addCriterion("room_create_time between", value1, value2, "roomCreateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRoomCreateTimeNotBetween(Long value1, Long value2) {
+            addCriterion("room_create_time not between", value1, value2, "roomCreateTime");
+            return (Criteria) this;
+        }
+
         public Criteria andAddUserStatusIsNull() {
             addCriterion("add_user_status is null");
             return (Criteria) this;

+ 11 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComRoomUser.java

@@ -27,6 +27,8 @@ public class ThirdPartWeComRoomUser {
 
     private Long joinTime;
 
+    private Long quitTime;
+
     private String nickname;
 
     private String roomNickname;
@@ -139,6 +141,14 @@ public class ThirdPartWeComRoomUser {
         this.joinTime = joinTime;
     }
 
+    public Long getQuitTime() {
+        return quitTime;
+    }
+
+    public void setQuitTime(Long quitTime) {
+        this.quitTime = quitTime;
+    }
+
     public String getNickname() {
         return nickname;
     }
@@ -221,6 +231,7 @@ public class ThirdPartWeComRoomUser {
         sb.append(", realname=").append(realname);
         sb.append(", roomNotes=").append(roomNotes);
         sb.append(", joinTime=").append(joinTime);
+        sb.append(", quitTime=").append(quitTime);
         sb.append(", nickname=").append(nickname);
         sb.append(", roomNickname=").append(roomNickname);
         sb.append(", position=").append(position);

+ 60 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComRoomUserExample.java

@@ -916,6 +916,66 @@ public class ThirdPartWeComRoomUserExample {
             return (Criteria) this;
         }
 
+        public Criteria andQuitTimeIsNull() {
+            addCriterion("quit_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeIsNotNull() {
+            addCriterion("quit_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeEqualTo(Long value) {
+            addCriterion("quit_time =", value, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeNotEqualTo(Long value) {
+            addCriterion("quit_time <>", value, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeGreaterThan(Long value) {
+            addCriterion("quit_time >", value, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeGreaterThanOrEqualTo(Long value) {
+            addCriterion("quit_time >=", value, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeLessThan(Long value) {
+            addCriterion("quit_time <", value, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeLessThanOrEqualTo(Long value) {
+            addCriterion("quit_time <=", value, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeIn(List<Long> values) {
+            addCriterion("quit_time in", values, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeNotIn(List<Long> values) {
+            addCriterion("quit_time not in", values, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeBetween(Long value1, Long value2) {
+            addCriterion("quit_time between", value1, value2, "quitTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andQuitTimeNotBetween(Long value1, Long value2) {
+            addCriterion("quit_time not between", value1, value2, "quitTime");
+            return (Criteria) this;
+        }
+
         public Criteria andNicknameIsNull() {
             addCriterion("nickname is null");
             return (Criteria) this;

+ 11 - 11
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComStaff.java

@@ -11,12 +11,12 @@ public class ThirdPartWeComStaff {
 
     private String name;
 
-    private String avatar;
-
     private Long thirdStaffId;
 
     private String thirdUuid;
 
+    private String avatar;
+
     private Integer status;
 
     private Integer autoCreateRoom;
@@ -57,14 +57,6 @@ public class ThirdPartWeComStaff {
         this.name = name;
     }
 
-    public String getAvatar() {
-        return avatar;
-    }
-
-    public void setAvatar(String avatar) {
-        this.avatar = avatar;
-    }
-
     public Long getThirdStaffId() {
         return thirdStaffId;
     }
@@ -81,6 +73,14 @@ public class ThirdPartWeComStaff {
         this.thirdUuid = thirdUuid;
     }
 
+    public String getAvatar() {
+        return avatar;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
     public Integer getStatus() {
         return status;
     }
@@ -123,9 +123,9 @@ public class ThirdPartWeComStaff {
         sb.append(", corpId=").append(corpId);
         sb.append(", mobile=").append(mobile);
         sb.append(", name=").append(name);
-        sb.append(", avatar=").append(avatar);
         sb.append(", thirdStaffId=").append(thirdStaffId);
         sb.append(", thirdUuid=").append(thirdUuid);
+        sb.append(", avatar=").append(avatar);
         sb.append(", status=").append(status);
         sb.append(", autoCreateRoom=").append(autoCreateRoom);
         sb.append(", createTime=").append(createTime);

+ 70 - 70
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComStaffExample.java

@@ -376,76 +376,6 @@ public class ThirdPartWeComStaffExample {
             return (Criteria) this;
         }
 
-        public Criteria andAvatarIsNull() {
-            addCriterion("avatar is null");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarIsNotNull() {
-            addCriterion("avatar is not null");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarEqualTo(String value) {
-            addCriterion("avatar =", value, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarNotEqualTo(String value) {
-            addCriterion("avatar <>", value, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarGreaterThan(String value) {
-            addCriterion("avatar >", value, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarGreaterThanOrEqualTo(String value) {
-            addCriterion("avatar >=", value, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarLessThan(String value) {
-            addCriterion("avatar <", value, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarLessThanOrEqualTo(String value) {
-            addCriterion("avatar <=", value, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarLike(String value) {
-            addCriterion("avatar like", value, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarNotLike(String value) {
-            addCriterion("avatar not like", value, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarIn(List<String> values) {
-            addCriterion("avatar in", values, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarNotIn(List<String> values) {
-            addCriterion("avatar not in", values, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarBetween(String value1, String value2) {
-            addCriterion("avatar between", value1, value2, "avatar");
-            return (Criteria) this;
-        }
-
-        public Criteria andAvatarNotBetween(String value1, String value2) {
-            addCriterion("avatar not between", value1, value2, "avatar");
-            return (Criteria) this;
-        }
-
         public Criteria andThirdStaffIdIsNull() {
             addCriterion("third_staff_id is null");
             return (Criteria) this;
@@ -576,6 +506,76 @@ public class ThirdPartWeComStaffExample {
             return (Criteria) this;
         }
 
+        public Criteria andAvatarIsNull() {
+            addCriterion("avatar is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarIsNotNull() {
+            addCriterion("avatar is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarEqualTo(String value) {
+            addCriterion("avatar =", value, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarNotEqualTo(String value) {
+            addCriterion("avatar <>", value, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarGreaterThan(String value) {
+            addCriterion("avatar >", value, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarGreaterThanOrEqualTo(String value) {
+            addCriterion("avatar >=", value, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarLessThan(String value) {
+            addCriterion("avatar <", value, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarLessThanOrEqualTo(String value) {
+            addCriterion("avatar <=", value, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarLike(String value) {
+            addCriterion("avatar like", value, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarNotLike(String value) {
+            addCriterion("avatar not like", value, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarIn(List<String> values) {
+            addCriterion("avatar in", values, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarNotIn(List<String> values) {
+            addCriterion("avatar not in", values, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarBetween(String value1, String value2) {
+            addCriterion("avatar between", value1, value2, "avatar");
+            return (Criteria) this;
+        }
+
+        public Criteria andAvatarNotBetween(String value1, String value2) {
+            addCriterion("avatar not between", value1, value2, "avatar");
+            return (Criteria) this;
+        }
+
         public Criteria andStatusIsNull() {
             addCriterion("`status` is null");
             return (Criteria) this;

+ 22 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComStaffUser.java

@@ -7,6 +7,10 @@ public class ThirdPartWeComStaffUser {
 
     private Long thirdStaffId;
 
+    private Long addCustomerTime;
+
+    private Long removeCustiomerTime;
+
     private String unionid;
 
     private Integer sex;
@@ -65,6 +69,22 @@ public class ThirdPartWeComStaffUser {
         this.thirdStaffId = thirdStaffId;
     }
 
+    public Long getAddCustomerTime() {
+        return addCustomerTime;
+    }
+
+    public void setAddCustomerTime(Long addCustomerTime) {
+        this.addCustomerTime = addCustomerTime;
+    }
+
+    public Long getRemoveCustiomerTime() {
+        return removeCustiomerTime;
+    }
+
+    public void setRemoveCustiomerTime(Long removeCustiomerTime) {
+        this.removeCustiomerTime = removeCustiomerTime;
+    }
+
     public String getUnionid() {
         return unionid;
     }
@@ -241,6 +261,8 @@ public class ThirdPartWeComStaffUser {
         sb.append("Hash = ").append(hashCode());
         sb.append(", id=").append(id);
         sb.append(", thirdStaffId=").append(thirdStaffId);
+        sb.append(", addCustomerTime=").append(addCustomerTime);
+        sb.append(", removeCustiomerTime=").append(removeCustiomerTime);
         sb.append(", unionid=").append(unionid);
         sb.append(", sex=").append(sex);
         sb.append(", mobile=").append(mobile);

+ 120 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/po/wecom/thirdpart/ThirdPartWeComStaffUserExample.java

@@ -236,6 +236,126 @@ public class ThirdPartWeComStaffUserExample {
             return (Criteria) this;
         }
 
+        public Criteria andAddCustomerTimeIsNull() {
+            addCriterion("add_customer_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeIsNotNull() {
+            addCriterion("add_customer_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeEqualTo(Long value) {
+            addCriterion("add_customer_time =", value, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeNotEqualTo(Long value) {
+            addCriterion("add_customer_time <>", value, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeGreaterThan(Long value) {
+            addCriterion("add_customer_time >", value, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeGreaterThanOrEqualTo(Long value) {
+            addCriterion("add_customer_time >=", value, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeLessThan(Long value) {
+            addCriterion("add_customer_time <", value, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeLessThanOrEqualTo(Long value) {
+            addCriterion("add_customer_time <=", value, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeIn(List<Long> values) {
+            addCriterion("add_customer_time in", values, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeNotIn(List<Long> values) {
+            addCriterion("add_customer_time not in", values, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeBetween(Long value1, Long value2) {
+            addCriterion("add_customer_time between", value1, value2, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andAddCustomerTimeNotBetween(Long value1, Long value2) {
+            addCriterion("add_customer_time not between", value1, value2, "addCustomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeIsNull() {
+            addCriterion("remove_custiomer_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeIsNotNull() {
+            addCriterion("remove_custiomer_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeEqualTo(Long value) {
+            addCriterion("remove_custiomer_time =", value, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeNotEqualTo(Long value) {
+            addCriterion("remove_custiomer_time <>", value, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeGreaterThan(Long value) {
+            addCriterion("remove_custiomer_time >", value, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeGreaterThanOrEqualTo(Long value) {
+            addCriterion("remove_custiomer_time >=", value, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeLessThan(Long value) {
+            addCriterion("remove_custiomer_time <", value, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeLessThanOrEqualTo(Long value) {
+            addCriterion("remove_custiomer_time <=", value, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeIn(List<Long> values) {
+            addCriterion("remove_custiomer_time in", values, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeNotIn(List<Long> values) {
+            addCriterion("remove_custiomer_time not in", values, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeBetween(Long value1, Long value2) {
+            addCriterion("remove_custiomer_time between", value1, value2, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andRemoveCustiomerTimeNotBetween(Long value1, Long value2) {
+            addCriterion("remove_custiomer_time not between", value1, value2, "removeCustiomerTime");
+            return (Criteria) this;
+        }
+
         public Criteria andUnionidIsNull() {
             addCriterion("unionid is null");
             return (Criteria) this;

+ 25 - 7
api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComRoomMapper.xml

@@ -10,6 +10,7 @@
     <result column="member_count" jdbcType="INTEGER" property="memberCount" />
     <result column="name" jdbcType="VARCHAR" property="name" />
     <result column="room_url" jdbcType="VARCHAR" property="roomUrl" />
+    <result column="room_create_time" jdbcType="BIGINT" property="roomCreateTime" />
     <result column="add_user_status" jdbcType="INTEGER" property="addUserStatus" />
     <result column="send_status" jdbcType="INTEGER" property="sendStatus" />
     <result column="send_time" jdbcType="VARCHAR" property="sendTime" />
@@ -77,7 +78,8 @@
   </sql>
   <sql id="Base_Column_List">
     id, corp_id, staff_id, third_room_id, third_create_user_id, member_count, `name`, 
-    room_url, add_user_status, send_status, send_time, is_delete, create_time, update_time
+    room_url, room_create_time, add_user_status, send_status, send_time, is_delete, create_time, 
+    update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoomExample" resultMap="BaseResultMap">
     select
@@ -116,14 +118,16 @@
           useGeneratedKeys="true" keyProperty="id">
     insert into third_part_we_com_room (id, corp_id, staff_id, 
       third_room_id, third_create_user_id, member_count, 
-      `name`, room_url, add_user_status, 
-      send_status, send_time, is_delete, 
-      create_time, update_time)
+      `name`, room_url, room_create_time, 
+      add_user_status, send_status, send_time, 
+      is_delete, create_time, update_time
+      )
     values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{staffId,jdbcType=BIGINT}, 
       #{thirdRoomId,jdbcType=VARCHAR}, #{thirdCreateUserId,jdbcType=BIGINT}, #{memberCount,jdbcType=INTEGER}, 
-      #{name,jdbcType=VARCHAR}, #{roomUrl,jdbcType=VARCHAR}, #{addUserStatus,jdbcType=INTEGER}, 
-      #{sendStatus,jdbcType=INTEGER}, #{sendTime,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+      #{name,jdbcType=VARCHAR}, #{roomUrl,jdbcType=VARCHAR}, #{roomCreateTime,jdbcType=BIGINT}, 
+      #{addUserStatus,jdbcType=INTEGER}, #{sendStatus,jdbcType=INTEGER}, #{sendTime,jdbcType=VARCHAR}, 
+      #{isDelete,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoom"
           useGeneratedKeys="true" keyProperty="id">
@@ -153,6 +157,9 @@
       <if test="roomUrl != null">
         room_url,
       </if>
+      <if test="roomCreateTime != null">
+        room_create_time,
+      </if>
       <if test="addUserStatus != null">
         add_user_status,
       </if>
@@ -197,6 +204,9 @@
       <if test="roomUrl != null">
         #{roomUrl,jdbcType=VARCHAR},
       </if>
+      <if test="roomCreateTime != null">
+        #{roomCreateTime,jdbcType=BIGINT},
+      </if>
       <if test="addUserStatus != null">
         #{addUserStatus,jdbcType=INTEGER},
       </if>
@@ -250,6 +260,9 @@
       <if test="record.roomUrl != null">
         room_url = #{record.roomUrl,jdbcType=VARCHAR},
       </if>
+      <if test="record.roomCreateTime != null">
+        room_create_time = #{record.roomCreateTime,jdbcType=BIGINT},
+      </if>
       <if test="record.addUserStatus != null">
         add_user_status = #{record.addUserStatus,jdbcType=INTEGER},
       </if>
@@ -283,6 +296,7 @@
       member_count = #{record.memberCount,jdbcType=INTEGER},
       `name` = #{record.name,jdbcType=VARCHAR},
       room_url = #{record.roomUrl,jdbcType=VARCHAR},
+      room_create_time = #{record.roomCreateTime,jdbcType=BIGINT},
       add_user_status = #{record.addUserStatus,jdbcType=INTEGER},
       send_status = #{record.sendStatus,jdbcType=INTEGER},
       send_time = #{record.sendTime,jdbcType=VARCHAR},
@@ -317,6 +331,9 @@
       <if test="roomUrl != null">
         room_url = #{roomUrl,jdbcType=VARCHAR},
       </if>
+      <if test="roomCreateTime != null">
+        room_create_time = #{roomCreateTime,jdbcType=BIGINT},
+      </if>
       <if test="addUserStatus != null">
         add_user_status = #{addUserStatus,jdbcType=INTEGER},
       </if>
@@ -347,6 +364,7 @@
       member_count = #{memberCount,jdbcType=INTEGER},
       `name` = #{name,jdbcType=VARCHAR},
       room_url = #{roomUrl,jdbcType=VARCHAR},
+      room_create_time = #{roomCreateTime,jdbcType=BIGINT},
       add_user_status = #{addUserStatus,jdbcType=INTEGER},
       send_status = #{sendStatus,jdbcType=INTEGER},
       send_time = #{sendTime,jdbcType=VARCHAR},

+ 25 - 8
api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComRoomUserMapper.xml

@@ -14,6 +14,7 @@
     <result column="realname" jdbcType="VARCHAR" property="realname" />
     <result column="room_notes" jdbcType="VARCHAR" property="roomNotes" />
     <result column="join_time" jdbcType="BIGINT" property="joinTime" />
+    <result column="quit_time" jdbcType="BIGINT" property="quitTime" />
     <result column="nickname" jdbcType="VARCHAR" property="nickname" />
     <result column="room_nickname" jdbcType="VARCHAR" property="roomNickname" />
     <result column="position" jdbcType="VARCHAR" property="position" />
@@ -83,8 +84,8 @@
   </sql>
   <sql id="Base_Column_List">
     id, third_room_id, unionid, sex, mobile, acctid, join_scene, avatar, english_name, 
-    realname, room_notes, join_time, nickname, room_nickname, `position`, uin, invite_user_id, 
-    corp_id, create_time, update_time
+    realname, room_notes, join_time, quit_time, nickname, room_nickname, `position`, 
+    uin, invite_user_id, corp_id, create_time, update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoomUserExample" resultMap="BaseResultMap">
     select
@@ -124,16 +125,18 @@
       sex, mobile, acctid, 
       join_scene, avatar, english_name, 
       realname, room_notes, join_time, 
-      nickname, room_nickname, `position`, 
-      uin, invite_user_id, corp_id, 
-      create_time, update_time)
+      quit_time, nickname, room_nickname, 
+      `position`, uin, invite_user_id, 
+      corp_id, create_time, update_time
+      )
     values (#{id,jdbcType=BIGINT}, #{thirdRoomId,jdbcType=VARCHAR}, #{unionid,jdbcType=VARCHAR}, 
       #{sex,jdbcType=INTEGER}, #{mobile,jdbcType=VARCHAR}, #{acctid,jdbcType=VARCHAR}, 
       #{joinScene,jdbcType=INTEGER}, #{avatar,jdbcType=VARCHAR}, #{englishName,jdbcType=VARCHAR}, 
       #{realname,jdbcType=VARCHAR}, #{roomNotes,jdbcType=VARCHAR}, #{joinTime,jdbcType=BIGINT}, 
-      #{nickname,jdbcType=VARCHAR}, #{roomNickname,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, 
-      #{uin,jdbcType=BIGINT}, #{inviteUserId,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+      #{quitTime,jdbcType=BIGINT}, #{nickname,jdbcType=VARCHAR}, #{roomNickname,jdbcType=VARCHAR}, 
+      #{position,jdbcType=VARCHAR}, #{uin,jdbcType=BIGINT}, #{inviteUserId,jdbcType=BIGINT}, 
+      #{corpId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComRoomUser">
     insert into third_part_we_com_room_user
@@ -174,6 +177,9 @@
       <if test="joinTime != null">
         join_time,
       </if>
+      <if test="quitTime != null">
+        quit_time,
+      </if>
       <if test="nickname != null">
         nickname,
       </if>
@@ -236,6 +242,9 @@
       <if test="joinTime != null">
         #{joinTime,jdbcType=BIGINT},
       </if>
+      <if test="quitTime != null">
+        #{quitTime,jdbcType=BIGINT},
+      </if>
       <if test="nickname != null">
         #{nickname,jdbcType=VARCHAR},
       </if>
@@ -307,6 +316,9 @@
       <if test="record.joinTime != null">
         join_time = #{record.joinTime,jdbcType=BIGINT},
       </if>
+      <if test="record.quitTime != null">
+        quit_time = #{record.quitTime,jdbcType=BIGINT},
+      </if>
       <if test="record.nickname != null">
         nickname = #{record.nickname,jdbcType=VARCHAR},
       </if>
@@ -350,6 +362,7 @@
       realname = #{record.realname,jdbcType=VARCHAR},
       room_notes = #{record.roomNotes,jdbcType=VARCHAR},
       join_time = #{record.joinTime,jdbcType=BIGINT},
+      quit_time = #{record.quitTime,jdbcType=BIGINT},
       nickname = #{record.nickname,jdbcType=VARCHAR},
       room_nickname = #{record.roomNickname,jdbcType=VARCHAR},
       `position` = #{record.position,jdbcType=VARCHAR},
@@ -398,6 +411,9 @@
       <if test="joinTime != null">
         join_time = #{joinTime,jdbcType=BIGINT},
       </if>
+      <if test="quitTime != null">
+        quit_time = #{quitTime,jdbcType=BIGINT},
+      </if>
       <if test="nickname != null">
         nickname = #{nickname,jdbcType=VARCHAR},
       </if>
@@ -438,6 +454,7 @@
       realname = #{realname,jdbcType=VARCHAR},
       room_notes = #{roomNotes,jdbcType=VARCHAR},
       join_time = #{joinTime,jdbcType=BIGINT},
+      quit_time = #{quitTime,jdbcType=BIGINT},
       nickname = #{nickname,jdbcType=VARCHAR},
       room_nickname = #{roomNickname,jdbcType=VARCHAR},
       `position` = #{position,jdbcType=VARCHAR},

+ 20 - 20
api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComStaffMapper.xml

@@ -6,9 +6,9 @@
     <result column="corp_id" jdbcType="BIGINT" property="corpId" />
     <result column="mobile" jdbcType="VARCHAR" property="mobile" />
     <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="avatar" jdbcType="VARCHAR" property="avatar" />
     <result column="third_staff_id" jdbcType="BIGINT" property="thirdStaffId" />
     <result column="third_uuid" jdbcType="VARCHAR" property="thirdUuid" />
+    <result column="avatar" jdbcType="VARCHAR" property="avatar" />
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="auto_create_room" jdbcType="INTEGER" property="autoCreateRoom" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
@@ -73,7 +73,7 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, corp_id, mobile, `name`, avatar, third_staff_id, third_uuid, `status`, auto_create_room, 
+    id, corp_id, mobile, `name`, third_staff_id, third_uuid, avatar, `status`, auto_create_room, 
     create_time, update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffExample" resultMap="BaseResultMap">
@@ -111,12 +111,12 @@
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaff">
     insert into third_part_we_com_staff (id, corp_id, mobile, 
-      `name`, avatar, third_staff_id, 
-      third_uuid, `status`, auto_create_room, 
+      `name`, third_staff_id, third_uuid, 
+      avatar, `status`, auto_create_room, 
       create_time, update_time)
     values (#{id,jdbcType=BIGINT}, #{corpId,jdbcType=BIGINT}, #{mobile,jdbcType=VARCHAR}, 
-      #{name,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{thirdStaffId,jdbcType=BIGINT}, 
-      #{thirdUuid,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{autoCreateRoom,jdbcType=INTEGER}, 
+      #{name,jdbcType=VARCHAR}, #{thirdStaffId,jdbcType=BIGINT}, #{thirdUuid,jdbcType=VARCHAR}, 
+      #{avatar,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{autoCreateRoom,jdbcType=INTEGER}, 
       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaff">
@@ -134,15 +134,15 @@
       <if test="name != null">
         `name`,
       </if>
-      <if test="avatar != null">
-        avatar,
-      </if>
       <if test="thirdStaffId != null">
         third_staff_id,
       </if>
       <if test="thirdUuid != null">
         third_uuid,
       </if>
+      <if test="avatar != null">
+        avatar,
+      </if>
       <if test="status != null">
         `status`,
       </if>
@@ -169,15 +169,15 @@
       <if test="name != null">
         #{name,jdbcType=VARCHAR},
       </if>
-      <if test="avatar != null">
-        #{avatar,jdbcType=VARCHAR},
-      </if>
       <if test="thirdStaffId != null">
         #{thirdStaffId,jdbcType=BIGINT},
       </if>
       <if test="thirdUuid != null">
         #{thirdUuid,jdbcType=VARCHAR},
       </if>
+      <if test="avatar != null">
+        #{avatar,jdbcType=VARCHAR},
+      </if>
       <if test="status != null">
         #{status,jdbcType=INTEGER},
       </if>
@@ -213,15 +213,15 @@
       <if test="record.name != null">
         `name` = #{record.name,jdbcType=VARCHAR},
       </if>
-      <if test="record.avatar != null">
-        avatar = #{record.avatar,jdbcType=VARCHAR},
-      </if>
       <if test="record.thirdStaffId != null">
         third_staff_id = #{record.thirdStaffId,jdbcType=BIGINT},
       </if>
       <if test="record.thirdUuid != null">
         third_uuid = #{record.thirdUuid,jdbcType=VARCHAR},
       </if>
+      <if test="record.avatar != null">
+        avatar = #{record.avatar,jdbcType=VARCHAR},
+      </if>
       <if test="record.status != null">
         `status` = #{record.status,jdbcType=INTEGER},
       </if>
@@ -245,9 +245,9 @@
       corp_id = #{record.corpId,jdbcType=BIGINT},
       mobile = #{record.mobile,jdbcType=VARCHAR},
       `name` = #{record.name,jdbcType=VARCHAR},
-      avatar = #{record.avatar,jdbcType=VARCHAR},
       third_staff_id = #{record.thirdStaffId,jdbcType=BIGINT},
       third_uuid = #{record.thirdUuid,jdbcType=VARCHAR},
+      avatar = #{record.avatar,jdbcType=VARCHAR},
       `status` = #{record.status,jdbcType=INTEGER},
       auto_create_room = #{record.autoCreateRoom,jdbcType=INTEGER},
       create_time = #{record.createTime,jdbcType=TIMESTAMP},
@@ -268,15 +268,15 @@
       <if test="name != null">
         `name` = #{name,jdbcType=VARCHAR},
       </if>
-      <if test="avatar != null">
-        avatar = #{avatar,jdbcType=VARCHAR},
-      </if>
       <if test="thirdStaffId != null">
         third_staff_id = #{thirdStaffId,jdbcType=BIGINT},
       </if>
       <if test="thirdUuid != null">
         third_uuid = #{thirdUuid,jdbcType=VARCHAR},
       </if>
+      <if test="avatar != null">
+        avatar = #{avatar,jdbcType=VARCHAR},
+      </if>
       <if test="status != null">
         `status` = #{status,jdbcType=INTEGER},
       </if>
@@ -297,9 +297,9 @@
     set corp_id = #{corpId,jdbcType=BIGINT},
       mobile = #{mobile,jdbcType=VARCHAR},
       `name` = #{name,jdbcType=VARCHAR},
-      avatar = #{avatar,jdbcType=VARCHAR},
       third_staff_id = #{thirdStaffId,jdbcType=BIGINT},
       third_uuid = #{thirdUuid,jdbcType=VARCHAR},
+      avatar = #{avatar,jdbcType=VARCHAR},
       `status` = #{status,jdbcType=INTEGER},
       auto_create_room = #{autoCreateRoom,jdbcType=INTEGER},
       create_time = #{createTime,jdbcType=TIMESTAMP},

+ 52 - 19
api-module/src/main/resources/mapper/wecom/thirdpart/ThirdPartWeComStaffUserMapper.xml

@@ -4,6 +4,8 @@
   <resultMap id="BaseResultMap" type="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
     <id column="id" jdbcType="BIGINT" property="id" />
     <result column="third_staff_id" jdbcType="BIGINT" property="thirdStaffId" />
+    <result column="add_customer_time" jdbcType="BIGINT" property="addCustomerTime" />
+    <result column="remove_custiomer_time" jdbcType="BIGINT" property="removeCustiomerTime" />
     <result column="unionid" jdbcType="VARCHAR" property="unionid" />
     <result column="sex" jdbcType="INTEGER" property="sex" />
     <result column="mobile" jdbcType="VARCHAR" property="mobile" />
@@ -85,9 +87,10 @@
     </where>
   </sql>
   <sql id="Base_Column_List">
-    id, third_staff_id, unionid, sex, mobile, company_remark, acctid, avatar, `source`, 
-    english_name, remark_phone, realname, real_remarks, labelid, user_id, nickname, `position`, 
-    corp_id, remarks, seq, `status`, create_time, update_time
+    id, third_staff_id, add_customer_time, remove_custiomer_time, unionid, sex, mobile, 
+    company_remark, acctid, avatar, `source`, english_name, remark_phone, realname, real_remarks, 
+    labelid, user_id, nickname, `position`, corp_id, remarks, seq, `status`, create_time, 
+    update_time
   </sql>
   <select id="selectByExample" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUserExample" resultMap="BaseResultMap">
     select
@@ -123,22 +126,24 @@
     </if>
   </delete>
   <insert id="insert" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
-    insert into third_part_we_com_staff_user (id, third_staff_id, unionid, 
-      sex, mobile, company_remark, 
-      acctid, avatar, `source`, 
-      english_name, remark_phone, realname, 
-      real_remarks, labelid, user_id, 
-      nickname, `position`, corp_id, 
-      remarks, seq, `status`, 
-      create_time, update_time)
-    values (#{id,jdbcType=BIGINT}, #{thirdStaffId,jdbcType=BIGINT}, #{unionid,jdbcType=VARCHAR}, 
-      #{sex,jdbcType=INTEGER}, #{mobile,jdbcType=VARCHAR}, #{companyRemark,jdbcType=VARCHAR}, 
-      #{acctid,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, 
-      #{englishName,jdbcType=VARCHAR}, #{remarkPhone,jdbcType=VARCHAR}, #{realname,jdbcType=VARCHAR}, 
-      #{realRemarks,jdbcType=VARCHAR}, #{labelid,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}, 
-      #{nickname,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{corpId,jdbcType=BIGINT}, 
-      #{remarks,jdbcType=VARCHAR}, #{seq,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
-      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
+    insert into third_part_we_com_staff_user (id, third_staff_id, add_customer_time, 
+      remove_custiomer_time, unionid, sex, 
+      mobile, company_remark, acctid, 
+      avatar, `source`, english_name, 
+      remark_phone, realname, real_remarks, 
+      labelid, user_id, nickname, 
+      `position`, corp_id, remarks, 
+      seq, `status`, create_time, 
+      update_time)
+    values (#{id,jdbcType=BIGINT}, #{thirdStaffId,jdbcType=BIGINT}, #{addCustomerTime,jdbcType=BIGINT}, 
+      #{removeCustiomerTime,jdbcType=BIGINT}, #{unionid,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, 
+      #{mobile,jdbcType=VARCHAR}, #{companyRemark,jdbcType=VARCHAR}, #{acctid,jdbcType=VARCHAR}, 
+      #{avatar,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER}, #{englishName,jdbcType=VARCHAR}, 
+      #{remarkPhone,jdbcType=VARCHAR}, #{realname,jdbcType=VARCHAR}, #{realRemarks,jdbcType=VARCHAR}, 
+      #{labelid,jdbcType=VARCHAR}, #{userId,jdbcType=BIGINT}, #{nickname,jdbcType=VARCHAR}, 
+      #{position,jdbcType=VARCHAR}, #{corpId,jdbcType=BIGINT}, #{remarks,jdbcType=VARCHAR}, 
+      #{seq,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
     insert into third_part_we_com_staff_user
@@ -149,6 +154,12 @@
       <if test="thirdStaffId != null">
         third_staff_id,
       </if>
+      <if test="addCustomerTime != null">
+        add_customer_time,
+      </if>
+      <if test="removeCustiomerTime != null">
+        remove_custiomer_time,
+      </if>
       <if test="unionid != null">
         unionid,
       </if>
@@ -220,6 +231,12 @@
       <if test="thirdStaffId != null">
         #{thirdStaffId,jdbcType=BIGINT},
       </if>
+      <if test="addCustomerTime != null">
+        #{addCustomerTime,jdbcType=BIGINT},
+      </if>
+      <if test="removeCustiomerTime != null">
+        #{removeCustiomerTime,jdbcType=BIGINT},
+      </if>
       <if test="unionid != null">
         #{unionid,jdbcType=VARCHAR},
       </if>
@@ -300,6 +317,12 @@
       <if test="record.thirdStaffId != null">
         third_staff_id = #{record.thirdStaffId,jdbcType=BIGINT},
       </if>
+      <if test="record.addCustomerTime != null">
+        add_customer_time = #{record.addCustomerTime,jdbcType=BIGINT},
+      </if>
+      <if test="record.removeCustiomerTime != null">
+        remove_custiomer_time = #{record.removeCustiomerTime,jdbcType=BIGINT},
+      </if>
       <if test="record.unionid != null">
         unionid = #{record.unionid,jdbcType=VARCHAR},
       </if>
@@ -372,6 +395,8 @@
     update third_part_we_com_staff_user
     set id = #{record.id,jdbcType=BIGINT},
       third_staff_id = #{record.thirdStaffId,jdbcType=BIGINT},
+      add_customer_time = #{record.addCustomerTime,jdbcType=BIGINT},
+      remove_custiomer_time = #{record.removeCustiomerTime,jdbcType=BIGINT},
       unionid = #{record.unionid,jdbcType=VARCHAR},
       sex = #{record.sex,jdbcType=INTEGER},
       mobile = #{record.mobile,jdbcType=VARCHAR},
@@ -403,6 +428,12 @@
       <if test="thirdStaffId != null">
         third_staff_id = #{thirdStaffId,jdbcType=BIGINT},
       </if>
+      <if test="addCustomerTime != null">
+        add_customer_time = #{addCustomerTime,jdbcType=BIGINT},
+      </if>
+      <if test="removeCustiomerTime != null">
+        remove_custiomer_time = #{removeCustiomerTime,jdbcType=BIGINT},
+      </if>
       <if test="unionid != null">
         unionid = #{unionid,jdbcType=VARCHAR},
       </if>
@@ -472,6 +503,8 @@
   <update id="updateByPrimaryKey" parameterType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
     update third_part_we_com_staff_user
     set third_staff_id = #{thirdStaffId,jdbcType=BIGINT},
+      add_customer_time = #{addCustomerTime,jdbcType=BIGINT},
+      remove_custiomer_time = #{removeCustiomerTime,jdbcType=BIGINT},
       unionid = #{unionid,jdbcType=VARCHAR},
       sex = #{sex,jdbcType=INTEGER},
       mobile = #{mobile,jdbcType=VARCHAR},

+ 46 - 31
api-module/src/main/resources/mapper/wecom/thirdpart/ext/ThirdPartWeComMapperExt.xml

@@ -2,45 +2,60 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.tzld.piaoquan.api.dao.mapper.wecom.thirdpart.ext.ThirdPartWeComMapperExt">
 
-  <insert id="batchInsertThirdPartWeComRoomUser">
-    insert into third_part_we_com_room_user (id, third_room_id, unionid, sex, mobile, acctid, join_scene, avatar, 
-       english_name, realname, room_notes, join_time, nickname, room_nickname, `position`, uin, invite_user_id, corp_id,
-       create_time, update_time)
-    values
-    <foreach collection="records" item="item" separator=",">
-      (#{item.id}, #{item.thirdRoomId}, #{item.unionid}, #{item.sex}, #{item.mobile}, #{item.acctid}, #{item.joinScene},
-       #{item.avatar}, #{item.englishName}, #{item.realname}, #{item.roomNotes}, #{item.joinTime}, #{item.nickname},
-       #{item.roomNickname}, #{item.position}, #{item.uin}, #{item.inviteUserId}, #{item.corpId}, #{item.createTime},
-       #{item.updateTime})
-    </foreach>
-  </insert>
+    <insert id="batchInsertThirdPartWeComRoomUser">
+        insert into third_part_we_com_room_user (id, third_room_id, unionid, sex, mobile, acctid, join_scene, avatar,
+        english_name, realname, room_notes, join_time, nickname, room_nickname, `position`, uin, invite_user_id,
+        corp_id,
+        create_time, update_time)
+        values
+        <foreach collection="records" item="item" separator=",">
+            (#{item.id}, #{item.thirdRoomId}, #{item.unionid}, #{item.sex}, #{item.mobile}, #{item.acctid},
+            #{item.joinScene},
+            #{item.avatar}, #{item.englishName}, #{item.realname}, #{item.roomNotes}, #{item.joinTime},
+            #{item.nickname},
+            #{item.roomNickname}, #{item.position}, #{item.uin}, #{item.inviteUserId}, #{item.corpId},
+            #{item.createTime},
+            #{item.updateTime})
+        </foreach>
+    </insert>
 
-  <insert id="batchInsertThirdPartWeComStaffUser">
-    insert into third_part_we_com_staff_user (id, third_staff_id, unionid, sex, mobile, company_remark,
-      acctid, avatar, `source`, english_name, remark_phone, realname, real_remarks, labelid, user_id,
-      nickname, `position`, corp_id, remarks, seq, `status`, create_time, update_time)
-    values
-    <foreach collection="records" item="item" separator=",">
-        (#{item.id}, #{item.thirdStaffId}, #{item.unionid}, #{item.sex}, #{item.mobile}, #{item.companyRemark},
-        #{item.acctid}, #{item.avatar}, #{item.source}, #{item.englishName}, #{item.remarkPhone}, #{item.realname},
-        #{item.realRemarks}, #{item.labelid}, #{item.userId}, #{item.nickname}, #{item.position}, #{item.corpId},
-        #{item.remarks}, #{item.seq}, #{item.status}, #{item.createTime}, #{item.updateTime})
-    </foreach>
-  </insert>
+    <insert id="batchInsertThirdPartWeComStaffUser">
+        insert into third_part_we_com_staff_user (id, third_staff_id, unionid, sex, mobile, company_remark,
+        acctid, avatar, `source`, english_name, remark_phone, realname, real_remarks, labelid, user_id,
+        nickname, `position`, corp_id, remarks, seq, `status`, create_time, update_time)
+        values
+        <foreach collection="records" item="item" separator=",">
+            (#{item.id}, #{item.thirdStaffId}, #{item.unionid}, #{item.sex}, #{item.mobile}, #{item.companyRemark},
+            #{item.acctid}, #{item.avatar}, #{item.source}, #{item.englishName}, #{item.remarkPhone}, #{item.realname},
+            #{item.realRemarks}, #{item.labelid}, #{item.userId}, #{item.nickname}, #{item.position}, #{item.corpId},
+            #{item.remarks}, #{item.seq}, #{item.status}, #{item.createTime}, #{item.updateTime})
+        </foreach>
+    </insert>
 
     <select id="getNoGroupStaffUserList"
             resultType="com.tzld.piaoquan.api.model.po.wecom.thirdpart.ThirdPartWeComStaffUser">
         select staff_user.*
         from third_part_we_com_staff staff
-         join third_part_we_com_staff_user staff_user on staff.third_staff_id = staff_user.third_staff_id
-        left join (select distinct room_user.uin
-                   from third_part_we_com_staff staff
-                    join third_part_we_com_room room on staff.id = room.staff_id
-                    join third_part_we_com_room_user room_user
-                         on room.third_room_id = room_user.third_room_id
-                   where staff.third_staff_id = #{thirdStaffId}) room_user on staff_user.user_id = room_user.uin
+                 join third_part_we_com_staff_user staff_user on staff.third_staff_id = staff_user.third_staff_id
+                 left join (select distinct room_user.uin
+                            from third_part_we_com_staff staff
+                                     join third_part_we_com_room room on staff.id = room.staff_id
+                                     join third_part_we_com_room_user room_user
+                                          on room.third_room_id = room_user.third_room_id
+                            where staff.third_staff_id = #{thirdStaffId}) room_user
+                           on staff_user.user_id = room_user.uin
         where staff.third_staff_id = #{thirdStaffId}
           and room_user.uin is null
     </select>
 
+    <update id="setRoomUserQuitTime">
+        update third_part_we_com_room_user
+        set quit_time = #{quitTime}
+        where third_room_id = #{thirdRoomId}
+        and uin in
+        <foreach collection="deleteList" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </update>
+
 </mapper>