Commit 9c196b4c by 徐高华

parent b28cb626
...@@ -21,9 +21,30 @@ public class GroupChatOwnerDTO implements Serializable { ...@@ -21,9 +21,30 @@ public class GroupChatOwnerDTO implements Serializable {
private String wxEnterpriseId; private String wxEnterpriseId;
/**群数量*/ /**群数量*/
private Integer chatCount; private Integer chatCount;
/**
* 微信用户id
*/
private String wxUserId;
private String wxOpenUserId;
private java.util.Date createTime; private java.util.Date createTime;
private java.util.Date updateTime; private java.util.Date updateTime;
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getWxOpenUserId() {
return wxOpenUserId;
}
public void setWxOpenUserId(String wxOpenUserId) {
this.wxOpenUserId = wxOpenUserId;
}
public String getStaffName() { public String getStaffName() {
return staffName; return staffName;
} }
......
...@@ -14,7 +14,7 @@ public class GroupChatSearchQDTO implements Serializable { ...@@ -14,7 +14,7 @@ public class GroupChatSearchQDTO implements Serializable {
private String enterpriseId; private String enterpriseId;
private String searchParams; private String searchParams;
// 群状态 0跟进人正常1跟进人离职2离职继承中 4已解散 // 群状态 0跟进人正常1跟进人离职2离职继承中 4已解散
private Integer status; private Integer status = 0;
private Date dismissStartDate; private Date dismissStartDate;
private Date dismissEndDate; private Date dismissEndDate;
// 群主列表 // 群主列表
......
...@@ -21,6 +21,16 @@ public class OwnerSearchQDTO implements Serializable { ...@@ -21,6 +21,16 @@ public class OwnerSearchQDTO implements Serializable {
private String wxEnterpriseId; private String wxEnterpriseId;
private String searchParams; private String searchParams;
// 1查询在职 2查离职
private int status = 1;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getSearchParams() { public String getSearchParams() {
return searchParams; return searchParams;
......
...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper.chat; ...@@ -2,6 +2,8 @@ package com.gic.haoban.manage.service.dao.mapper.chat;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.chat.TabChatNotice; import com.gic.haoban.manage.service.entity.chat.TabChatNotice;
/** /**
...@@ -17,7 +19,7 @@ public interface ChatNoticeMapper { ...@@ -17,7 +19,7 @@ public interface ChatNoticeMapper {
public int insert(TabChatNotice entity); public int insert(TabChatNotice entity);
public int closeAll(); public int closeAll(@Param("list") List<Integer> typeList);
public List<TabChatNotice> listAll(); public List<TabChatNotice> listAll(@Param("list") List<Integer> typeList);
} }
\ No newline at end of file
...@@ -16,13 +16,7 @@ import com.gic.haoban.manage.service.entity.chat.TabGroupChatData; ...@@ -16,13 +16,7 @@ import com.gic.haoban.manage.service.entity.chat.TabGroupChatData;
*/ */
public interface GroupChatDataMapper { public interface GroupChatDataMapper {
/** public int insert(TabGroupChatData entity);
* 新增
* @Title: insert
* @Description: TODO
* @Param @param TabHaobanGroupChatData
*/
public int insert(TabGroupChatData tabHaobanGroupChatData) ;
public List<TabGroupChatData> listByParams(Map<String,Object> params) ; public List<TabGroupChatData> listByParams(Map<String, Object> params);
} }
\ No newline at end of file
...@@ -19,9 +19,21 @@ public interface GroupChatHmRelationMapper { ...@@ -19,9 +19,21 @@ public interface GroupChatHmRelationMapper {
public int insert(TabGroupChatHmRelation entity); public int insert(TabGroupChatHmRelation entity);
public int deleteById(@Param("chatHmId")Long chatHmId , @Param("groupChatId")Long groupChatId); public int deleteById(@Param("chatHmId") Long chatHmId, @Param("groupChatId") Long groupChatId);
public int updateStatus(@Param("chatHmId")Long chatHmId , @Param("groupChatId")Long groupChatId , @Param("statusFlag")int statusFlag); public int updateStatus(@Param("chatHmId") Long chatHmId, @Param("groupChatId") Long groupChatId,
@Param("statusFlag") int statusFlag);
public List<TabGroupChatHmRelation> listByChatHmId(@Param("chatHmId")Long chatHmId); public List<TabGroupChatHmRelation> listByChatHmId(@Param("chatHmId") Long chatHmId);
/**
*
* @Title: listChatHmId
* @Description: 查询群关联的活码ID
* @author xugh
* @param groupChatId
* @return
* @throws
*/
public List<Long> listChatHmId(@Param("groupChatId") Long groupChatId);
} }
\ No newline at end of file
...@@ -34,6 +34,9 @@ public interface GroupChatMapper { ...@@ -34,6 +34,9 @@ public interface GroupChatMapper {
// 更新群状态 // 更新群状态
public int updateChatStatus(@Param("groupChatId") Long groupChatId, @Param("chatStatus") int chatStatus); public int updateChatStatus(@Param("groupChatId") Long groupChatId, @Param("chatStatus") int chatStatus);
// 更下线
public int chatOff(@Param("groupChatId") Long groupChatId);
public TabGroupChat selectById(Long groupChatId); public TabGroupChat selectById(Long groupChatId);
public List<TabGroupChat> listByIdSet(@Param("idList") Set<Long> idList); public List<TabGroupChat> listByIdSet(@Param("idList") Set<Long> idList);
......
...@@ -56,6 +56,15 @@ public class TabGroupChat implements Serializable{ ...@@ -56,6 +56,15 @@ public class TabGroupChat implements Serializable{
private String wxChatIdDk; private String wxChatIdDk;
private Date offTime ; private Date offTime ;
private String originalStaffId ; private String originalStaffId ;
private int hmAddStatus = 1 ;
public int getHmAddStatus() {
return hmAddStatus;
}
public void setHmAddStatus(int hmAddStatus) {
this.hmAddStatus = hmAddStatus;
}
public Date getOffTime() { public Date getOffTime() {
return offTime; return offTime;
......
...@@ -2,4 +2,13 @@ package com.gic.haoban.manage.service.service.chat; ...@@ -2,4 +2,13 @@ package com.gic.haoban.manage.service.service.chat;
public interface GroupChatDataService { public interface GroupChatDataService {
/**
*
* @Title: chatDataTimer
* @Description: 统计
* @author xugh
* @param params
* @throws
*/
public void chatDataTimer(String params) ;
} }
\ No newline at end of file
...@@ -14,5 +14,14 @@ public interface GroupChatHmService { ...@@ -14,5 +14,14 @@ public interface GroupChatHmService {
public Page<GroupChatHmBO> listPage(ChatHmSearchQDTO qdto, BasePageInfo basePageInfo); public Page<GroupChatHmBO> listPage(ChatHmSearchQDTO qdto, BasePageInfo basePageInfo);
/**
*
* @Title: handleChatOff
* @Description: 群下线后活码处理
* @author xugh
* @param groupChat
* @throws
*/
public void handleChatOff(Long groupChat);
} }
\ No newline at end of file
...@@ -104,4 +104,5 @@ public interface GroupChatService { ...@@ -104,4 +104,5 @@ public interface GroupChatService {
* @throws * @throws
*/ */
public void transfer(String wxEnterpriseId , String staffId , List<Long> groupChatIdList) ; public void transfer(String wxEnterpriseId , String staffId , List<Long> groupChatIdList) ;
} }
\ No newline at end of file
package com.gic.haoban.manage.service.service.chat.impl; package com.gic.haoban.manage.service.service.chat.impl;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.DateUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatDataMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatOwnerMapper;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatData;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatDataService; import com.gic.haoban.manage.service.service.chat.GroupChatDataService;
import com.gic.wechat.api.dto.qywx.chat.GroupChatQwDataDTO;
import com.gic.wechat.api.dto.qywx.chat.GroupChatQwDataItemDTO;
import com.gic.wechat.api.service.qywx.QywxChatApiService;
@Service @Service
public class GroupChatDataServiceImpl implements GroupChatDataService { public class GroupChatDataServiceImpl implements GroupChatDataService {
private static final Logger logger = LoggerFactory.getLogger(GroupChatDataService.class);
@Autowired
private QywxChatApiService qywxChatApiService;
@Autowired
private WxEnterpriseService wxEnterpriseService;
@Autowired
private Config config;
@Autowired
private GroupChatOwnerMapper groupChatOwnerMapper;
@Autowired
private GroupChatDataMapper groupChatDataMapper;
@Override
public void chatDataTimer(String params) {
t("f5f8c78e395e4ca1a493707316096097");
}
private void t(String wxEnterpriseId) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (null == qwDTO) {
logger.info("wxEnterpriseId不存在,id={}", wxEnterpriseId);
return;
}
OwnerSearchQDTO qdto = new OwnerSearchQDTO();
qdto.setWxEnterpriseId(wxEnterpriseId);
List<GroupChatOwnerDTO> list = this.groupChatOwnerMapper.listOwner(qdto);
List<String> userIdList = null;
Map<String, String> staffIdMap = new HashMap<>();
if (qwDTO.needOpenUserId3th()) {
userIdList = list.stream().map(dto -> dto.getWxOpenUserId()).collect(Collectors.toList());
staffIdMap = list.stream().collect(Collectors.toMap(GroupChatOwnerDTO::getWxOpenUserId,
GroupChatOwnerDTO::getStaffId, (k1, k2) -> k1));
} else {
userIdList = list.stream().map(dto -> dto.getWxUserId()).collect(Collectors.toList());
staffIdMap = list.stream().collect(
Collectors.toMap(GroupChatOwnerDTO::getWxUserId, GroupChatOwnerDTO::getStaffId, (k1, k2) -> k1));
}
Date date = DateUtil.addDay(DateUtil.getStartTimeOfDay(), -1);
ServiceResponse<List<GroupChatQwDataDTO>> resp = this.qywxChatApiService.statistic(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), userIdList, date.getTime() / 1000, date.getTime() / 1000);
logger.info(JSON.toJSONString(resp));
List<GroupChatQwDataDTO> dataList = resp.getResult();
if (CollectionUtils.isEmpty(dataList)) {
return;
}
for (GroupChatQwDataDTO dto : dataList) {
String userId = dto.getOwner();
if (StringUtils.isEmpty(staffIdMap.get(userId))) {
continue;
}
GroupChatQwDataItemDTO item = dto.getData();
TabGroupChatData entity = new TabGroupChatData();
entity.setDataId(UniqueIdUtils.uniqueLong());
entity.setDate(date);
entity.setWxEnterpriseId(wxEnterpriseId);
entity.setStaffId(staffIdMap.get(userId));
entity.setMsgTotal(item.getMsg_total());
entity.setChatHasMsg(item.getChat_has_msg());
entity.setChatTotal(item.getChat_total());
entity.setNewChatCnt(item.getNew_chat_cnt());
entity.setMigrateTraineeChatCnt(item.getMigrate_trainee_chat_cnt());
entity.setMemberHasMsg(item.getMember_has_msg());
entity.setMemberTotal(item.getMember_total());
entity.setNewMemberCnt(item.getNew_member_cnt());
this.groupChatDataMapper.insert(entity);
}
}
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import java.util.HashSet; ...@@ -5,6 +5,7 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -78,6 +79,56 @@ public class GroupChatHmServiceImpl implements GroupChatHmService { ...@@ -78,6 +79,56 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
} }
@Override @Override
public void handleChatOff(Long groupChatId) {
List<Long> hmIdList = this.groupChatHmRelationMapper.listChatHmId(groupChatId);
if (CollectionUtils.isEmpty(hmIdList)) {
logger.info("群下线,处理群活码,无关联活码,chatid={}", groupChatId);
return;
}
for (Long chatHmId : hmIdList) {
TabGroupChatHm hm = this.groupChatHmMapper.selectById(chatHmId);
if (null == hm) {
logger.info("群活码不存在,chatHmId={}", chatHmId);
return;
}
List<TabGroupChatHmRelation> chatRelation = this.groupChatHmRelationMapper.listByChatHmId(chatHmId);
if (CollectionUtils.isEmpty(chatRelation)) {
logger.info("群活码无关联群,chatHmId={}", chatHmId);
break;
}
String wxEnterpriseId = hm.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId,
SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting) {
logger.info("没有配置代开应用");
}
String configId = hm.getWxConfigId();
ServiceResponse<AddJoinWayDTO> joinResp = this.qywxChatApiService.getJoinWay(qwDTO.getDkCorpid(),
secretSetting.getSecretVal(), configId);
logger.info("查询群活码={}", JSON.toJSON(joinResp));
if (joinResp.isSuccess()) {
AddJoinWayDTO join = joinResp.getResult();
List<String> qwChatIdList = join.getChat_id_list();
if (CollectionUtils.isNotEmpty(qwChatIdList)) {
List<Long> chatIdList = chatRelation.stream().map(dto -> dto.getGroupChatId())
.collect(Collectors.toList());
List<TabGroupChat> chatList = this.groupChatMapper.listByIdSet(new HashSet<>(chatIdList));
List<String> hbIdList = chatList.stream().map(dto -> dto.getWxChatId())
.collect(Collectors.toList());
this.t(qwChatIdList, hbIdList, chatHmId);
}
}
}
}
private void t(List<String> qwIdList, List<String> hbIdList, Long chatHmId) {
if (CollectionUtils.isEmpty(hbIdList)) {
}
}
@Override
public void saveHm(GroupChatHmDTO dto) { public void saveHm(GroupChatHmDTO dto) {
String wxEnterpriseId = dto.getWxEnterpriseId(); String wxEnterpriseId = dto.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
...@@ -96,9 +147,10 @@ public class GroupChatHmServiceImpl implements GroupChatHmService { ...@@ -96,9 +147,10 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
} }
dto.setChatHmId(hmid); dto.setChatHmId(hmid);
dto.setChatHmCode("HM10" + hmid); dto.setChatHmCode("HM10" + hmid);
List<Long> chatidList = dto.getChatIdList() ; List<Long> chatidList = dto.getChatIdList();
List<TabGroupChat> chatList = this.groupChatMapper.listByIdSet(new HashSet<>(chatidList)); List<TabGroupChat> chatList = this.groupChatMapper.listByIdSet(new HashSet<>(chatidList));
List<String> wxChatidList = chatList.stream().filter(item->StringUtils.isNotBlank(item.getWxChatIdDk())).map(item -> item.getWxChatIdDk()).collect(Collectors.toList()); List<String> wxChatidList = chatList.stream().filter(item -> StringUtils.isNotBlank(item.getWxChatIdDk()))
.map(item -> item.getWxChatIdDk()).collect(Collectors.toList());
logger.info("企微群id={}", wxChatidList); logger.info("企微群id={}", wxChatidList);
AddJoinWayDTO joinDTO = new AddJoinWayDTO(); AddJoinWayDTO joinDTO = new AddJoinWayDTO();
joinDTO.setScene(2); joinDTO.setScene(2);
...@@ -136,11 +188,11 @@ public class GroupChatHmServiceImpl implements GroupChatHmService { ...@@ -136,11 +188,11 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
hm.setWxQrCode(qrCode); hm.setWxQrCode(qrCode);
this.groupChatHmMapper.insert(hm); this.groupChatHmMapper.insert(hm);
// 保存realtion // 保存realtion
for(TabGroupChat item : chatList) { for (TabGroupChat item : chatList) {
TabGroupChatHmRelation entity = EntityUtil.changeEntity(TabGroupChatHmRelation.class, item) ; TabGroupChatHmRelation entity = EntityUtil.changeEntity(TabGroupChatHmRelation.class, item);
entity.setChatHmId(hm.getChatHmId()); entity.setChatHmId(hm.getChatHmId());
entity.setRelationId(UniqueIdUtils.uniqueLong()); entity.setRelationId(UniqueIdUtils.uniqueLong());
this.groupChatHmRelationMapper.insert(entity) ; this.groupChatHmRelationMapper.insert(entity);
} }
} }
} }
......
...@@ -53,6 +53,7 @@ import com.gic.haoban.manage.service.service.SecretSettingService; ...@@ -53,6 +53,7 @@ import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService; import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatHmService;
import com.gic.haoban.manage.service.service.chat.GroupChatService; import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.member.api.dto.MemberDTO; import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberService; import com.gic.member.api.service.MemberService;
...@@ -97,11 +98,15 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -97,11 +98,15 @@ public class GroupChatServiceImpl implements GroupChatService {
private GroupChatOwnerHistoryMapper groupChatOwnerHistoryMapper; private GroupChatOwnerHistoryMapper groupChatOwnerHistoryMapper;
@Autowired @Autowired
private WxEnterpriseRelatedService wxEnterpriseRelatedService; private WxEnterpriseRelatedService wxEnterpriseRelatedService;
@Autowired
private GroupChatHmService groupChatHmService;
// 每次拉取成员数 // 每次拉取成员数
private int pageSize = 10; private int pageSize = 10;
// 每次拉取群数 // 每次拉取群数
private int limit = 1; private int limit = 1;
// 群下线成员数
private int offNum = 200;
@Override @Override
public void createChat(String corpid, String wxChatId) { public void createChat(String corpid, String wxChatId) {
...@@ -115,6 +120,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -115,6 +120,7 @@ public class GroupChatServiceImpl implements GroupChatService {
@Override @Override
public void dismissChat(String corpid, String wxChatId) { public void dismissChat(String corpid, String wxChatId) {
logger.info("解散群corpid={},wxChatId={}", corpid, wxChatId);
String wxEnterpriseId = this.getWxEnterpriesId(corpid); String wxEnterpriseId = this.getWxEnterpriesId(corpid);
if (null == wxEnterpriseId) { if (null == wxEnterpriseId) {
return; return;
...@@ -201,8 +207,9 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -201,8 +207,9 @@ public class GroupChatServiceImpl implements GroupChatService {
@Override @Override
public void handChatNotice(String params) { public void handChatNotice(String params) {
List<TabChatNotice> list = this.chatNoticeMapper.listAll(); // 处理群通知
this.chatNoticeMapper.closeAll(); List<TabChatNotice> list = this.chatNoticeMapper.listAll(Arrays.asList(1, 2, 3));
this.chatNoticeMapper.closeAll(Arrays.asList(1, 2, 3));
for (TabChatNotice item : list) { for (TabChatNotice item : list) {
int type = item.getType(); int type = item.getType();
String wxEnterpriseId = item.getWxEnterpriseId(); String wxEnterpriseId = item.getWxEnterpriseId();
...@@ -218,6 +225,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -218,6 +225,7 @@ public class GroupChatServiceImpl implements GroupChatService {
this.updateGroupChatDetail(qwDTO, groupChatId, true); this.updateGroupChatDetail(qwDTO, groupChatId, true);
} }
} }
} }
@Override @Override
...@@ -434,6 +442,9 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -434,6 +442,9 @@ public class GroupChatServiceImpl implements GroupChatService {
return; return;
} }
List<GroupChatDetailMemberDTO> memberList = detail.getMember_list(); List<GroupChatDetailMemberDTO> memberList = detail.getMember_list();
if (CollectionUtils.isNotEmpty(memberList) && memberList.size() >= offNum) {
this.chatOff(chat);
}
List<TabGroupChatUser> userList = new ArrayList<>(); List<TabGroupChatUser> userList = new ArrayList<>();
List<TabGroupChatUser> allUserList = this.groupChatUserMapper.listAllChatUser(wxEnterpriseId, groupChatId); List<TabGroupChatUser> allUserList = this.groupChatUserMapper.listAllChatUser(wxEnterpriseId, groupChatId);
Map<String, TabGroupChatUser> userMap = allUserList.stream() Map<String, TabGroupChatUser> userMap = allUserList.stream()
...@@ -640,7 +651,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -640,7 +651,7 @@ public class GroupChatServiceImpl implements GroupChatService {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (null == qwDTO) { if (null == qwDTO) {
logger.info("wxEnterpriseId不存在,id={}", wxEnterpriseId); logger.info("wxEnterpriseId不存在,id={}", wxEnterpriseId);
return ; return;
} }
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId); TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId);
String userid = staff.getWxUserId(); String userid = staff.getWxUserId();
...@@ -651,6 +662,15 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -651,6 +662,15 @@ public class GroupChatServiceImpl implements GroupChatService {
List<String> wxChatIdList = list.stream().map(dto -> dto.getWxChatId()).collect(Collectors.toList()); List<String> wxChatIdList = list.stream().map(dto -> dto.getWxChatId()).collect(Collectors.toList());
ServiceResponse<List<FailChatListDTO>> resp = this.qywxChatApiService.transfer(qwDTO.getThirdCorpid(), ServiceResponse<List<FailChatListDTO>> resp = this.qywxChatApiService.transfer(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), wxChatIdList, userid); config.getWxSuiteid(), wxChatIdList, userid);
logger.info("群继承={}",JSON.toJSONString(resp)); logger.info("群继承={}", JSON.toJSONString(resp));
}
// 群下线
private void chatOff(TabGroupChat chat) {
Long groupChatId = chat.getGroupChatId();
// 群下线
this.groupChatMapper.chatOff(groupChatId);
// 通知处理群活码
this.groupChatHmService.handleChatOff(groupChatId);
} }
} }
\ No newline at end of file
...@@ -51,10 +51,19 @@ ...@@ -51,10 +51,19 @@
status_flag=1, status_flag=1,
update_time=now() update_time=now()
where create_time > DATE_ADD(NOW(),INTERVAL -30 MINUTE) where create_time > DATE_ADD(NOW(),INTERVAL -30 MINUTE)
and type in
<foreach collection="list" close=")" index="index" item="type" open="(" separator=",">
#{type}
</foreach>
</update> </update>
<select id="listAll" resultMap="result-map-tabHaobanChatNotice"> <select id="listAll" resultMap="result-map-tabHaobanChatNotice">
select wx_enterprise_id wxEnterpriseId , chat_id chatId , type from tab_haoban_chat_notice where create_time > DATE_ADD(NOW(),INTERVAL -30 MINUTE) and status_flag = 0 select wx_enterprise_id wxEnterpriseId , chat_id chatId , type from tab_haoban_chat_notice where create_time > DATE_ADD(NOW(),INTERVAL -30 MINUTE) and status_flag = 0
and type in
<foreach collection="list" close=")" index="index" item="type" open="(" separator=",">
#{type}
</foreach>
group by wx_enterprise_id , chat_id , type group by wx_enterprise_id , chat_id , type
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -52,24 +52,25 @@ ...@@ -52,24 +52,25 @@
migrate_trainee_chat_cnt, migrate_trainee_chat_cnt,
create_time create_time
)VALUES( )VALUES(
#{dataId,jdbcType=BIGINT}, #{dataId},
#{wxEnterpriseId,jdbcType=CHAR}, #{wxEnterpriseId},
#{staffId,jdbcType=CHAR}, #{staffId},
#{date,jdbcType=DATE}, #{date},
#{newChatCnt,jdbcType=INTEGER}, #{newChatCnt},
#{chatTotal,jdbcType=INTEGER}, #{chatTotal},
#{chatHasMsg,jdbcType=INTEGER}, #{chatHasMsg},
#{newMemberCnt,jdbcType=INTEGER}, #{newMemberCnt},
#{memberTotal,jdbcType=INTEGER}, #{memberTotal},
#{memberHasMsg,jdbcType=INTEGER}, #{memberHasMsg},
#{msgTotal,jdbcType=INTEGER}, #{msgTotal},
#{migrateTraineeChatCnt,jdbcType=INTEGER}, #{migrateTraineeChatCnt},
#{createTime,jdbcType=TIMESTAMP} now()
) )
]]> ]]>
</insert> </insert>
<select id="listByParams" parameterType="java.util.Map" resultMap="result-map-tabHaobanGroupChatData"> <select id="listByParams" parameterType="java.util.Map"
resultMap="result-map-tabHaobanGroupChatData">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_group_chat_data from tab_haoban_group_chat_data
......
...@@ -74,6 +74,12 @@ ...@@ -74,6 +74,12 @@
<select id="listByChatHmId" resultMap="result-map-tabHaobanGroupChatHmRelation"> <select id="listByChatHmId" resultMap="result-map-tabHaobanGroupChatHmRelation">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from tab_haoban_group_chat_hm_relation where chat_hm_id = #{chatHmId} and delete_flag = 0 from tab_haoban_group_chat_hm_relation where chat_hm_id = #{chatHmId} and delete_flag = 0 and status_flag = 1
</select>
<select id="listChatHmId" resultMap="result-map-tabHaobanGroupChatHmRelation" resultType="long">
select
distinct(chat_hm_id)
from tab_haoban_group_chat_hm_relation where group_chat_id = #{groupChatId} and delete_flag = 0
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
<result column="wx_chat_id_dk" property="wxChatIdDk" /> <result column="wx_chat_id_dk" property="wxChatIdDk" />
<result column="off_time" property="offTime"/> <result column="off_time" property="offTime"/>
<result column="original_staff_id" property="originalStaffId"/> <result column="original_staff_id" property="originalStaffId"/>
<result column="hm_add_status" property="hmAddStatus"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
group_chat_id, group_chat_id,
...@@ -48,7 +49,7 @@ ...@@ -48,7 +49,7 @@
quit_count, quit_count,
quit_member_count, quit_member_count,
enterprise_id, enterprise_id,
gic_flag , init_flag , wx_chat_id_dk , off_time, original_staff_id gic_flag , init_flag , wx_chat_id_dk , off_time, original_staff_id , hm_add_status
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
<insert id="insert" <insert id="insert"
...@@ -74,7 +75,7 @@ ...@@ -74,7 +75,7 @@
quit_count, quit_count,
quit_member_count, quit_member_count,
enterprise_id, enterprise_id,
gic_flag , init_flag , original_staff_id gic_flag , init_flag , original_staff_id , hm_add_status
)VALUES( )VALUES(
#{groupChatId}, #{groupChatId},
#{wxEnterpriseId}, #{wxEnterpriseId},
...@@ -95,7 +96,7 @@ ...@@ -95,7 +96,7 @@
#{quitCount}, #{quitCount},
#{quitMemberCount}, #{quitMemberCount},
#{enterpriseId}, #{enterpriseId},
#{gicFlag} , #{initFlag} , #{originalStaffId} #{gicFlag} , #{initFlag} , #{originalStaffId} , 1
) )
]]> ]]>
</insert> </insert>
...@@ -124,13 +125,16 @@ ...@@ -124,13 +125,16 @@
</update> </update>
<update id="updateChatStatus"> <update id="updateChatStatus">
update tab_haoban_group_chat set chat_status = #{chatStatus} , update tab_haoban_group_chat set chat_status = #{chatStatus}
<if test="chatStatus==4"> <if test="chatStatus==4">
and chat_dissolve_time = now() , chat_dissolve_time = now()
</if> </if>
update_time =now() where group_chat_id = #{groupChatId} , update_time =now() where group_chat_id = #{groupChatId}
</update> </update>
<update id="chatOff">
update tab_haoban_group_chat set hm_add_status = 2 , off_time = now() , update_time =now() where group_chat_id = #{groupChatId} and total_count >= 200
</update>
<!-- ============ 查询============= --> <!-- ============ 查询============= -->
<select id="selectById" parameterType="long" <select id="selectById" parameterType="long"
...@@ -178,6 +182,18 @@ ...@@ -178,6 +182,18 @@
<if test="null != staffId"> <if test="null != staffId">
and staff_id = #{staffId} and staff_id = #{staffId}
</if> </if>
<if test="null == status or 0==status">
and chat_status in (0,3)
</if>
<if test="null != status and 1==status">
and chat_status = 1
</if>
<if test="null != status and 2==status">
and chat_status = 2
</if>
<if test="null != status and 4==status">
and chat_status = 4
</if>
</select> </select>
<update id="updateChatEnterpriseId"> <update id="updateChatEnterpriseId">
......
...@@ -51,11 +51,18 @@ ...@@ -51,11 +51,18 @@
<select id="listOwner" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO"> <select id="listOwner" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.OwnerSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatOwnerDTO">
SELECT a.staff_id staffId , b.`staff_name` staffName , a.wx_enterprise_id wxEnterpriseId SELECT a.staff_id staffId , b.`staff_name` staffName , a.wx_enterprise_id wxEnterpriseId ,
b.wx_user_id wxUserId , b.wx_open_user_id wxOpenUserId
FROM tab_haoban_group_chat_owner a LEFT JOIN tab_haoban_staff b ON a.`staff_id` = b.`staff_id` FROM tab_haoban_group_chat_owner a LEFT JOIN tab_haoban_staff b ON a.`staff_id` = b.`staff_id`
where a.wx_enterprise_id=#{wxEnterpriseId} where a.wx_enterprise_id=#{wxEnterpriseId}
<if test="null != searchParams"> <if test="null != searchParams">
and b.staff_name like '%${searchParams}%' and b.staff_name like '%${searchParams}%'
</if> </if>
<if test="status==1">
and b.status_flag = 1
</if>
<if test="status==2">
and b.status_flag = 0
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment