Commit df1b231e by 徐高华

群-自建

parent 28d41b70
......@@ -128,8 +128,13 @@ public class GroupChatDataServiceImpl implements GroupChatDataService {
Date date = DateUtil.addDay(DateUtil.getStartTimeOfDay(), -1);
Long time = date.getTime() / 1000;
ServiceResponse<List<GroupChatQwDataDTO>> resp = this.qywxChatApiService.statistic(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), userIdList, time, time);
ServiceResponse<List<GroupChatQwDataDTO>> resp = null ;
if(qwDTO.isSelf()) {
resp = this.qywxChatApiService.statisticSelf(qwDTO.getThirdCorpid(), qwDTO.getSelfSecret(), userIdList, time, time);
}else{
resp = this.qywxChatApiService.statistic(qwDTO.getThirdCorpid(), config.getWxSuiteid(), userIdList, time, time);
}
List<GroupChatQwDataDTO> dataList = resp.getResult();
if (CollectionUtils.isEmpty(dataList)) {
if (list.size() < pageSize) {
......
......@@ -307,8 +307,14 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
if (qwDTO.needOpenUserId3th()) {
userid = staff.getWxOpenUseId();
}
JSONResponse respon = qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
msgid, null, userid);
JSONResponse respon = null ;
if(qwDTO.isSelf()) {
respon = qywxSuiteApiService.resultExternalMessageSelf(qwDTO.getThirdCorpid(), qwDTO.getSelfSecret(),
msgid, null, userid);
}else {
respon = qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
msgid, null, userid);
}
logger.info("统计企微返回={}", JSON.toJSONString(respon));
if (respon.getErrorCode() != 0) {
return;
......
......@@ -530,8 +530,14 @@ public class GroupChatServiceImpl implements GroupChatService {
private void syncGroupChatList(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor,
boolean syncDetailFlag) {
logger.info("同步群列表={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor);
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList3th(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), userIdList, limit, cursor);
ServiceResponse<GroupChatListDTO> resp = null ;
if(qwDTO.isSelf()) {
resp = this.qywxChatApiService.groupchatList(qwDTO.getThirdCorpid(),
qwDTO.getSelfSecret() , userIdList, limit, cursor);
}else {
resp = this.qywxChatApiService.groupchatList3th(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), userIdList, limit, cursor);
}
if (!resp.isSuccess()) {
logger.info("拉取群列表异常={}", JSON.toJSON(resp));
return;
......@@ -614,8 +620,14 @@ public class GroupChatServiceImpl implements GroupChatService {
Long groupChatId = chat.getGroupChatId();
String wxEnterpriseId = chat.getWxEnterpriseId();
String enterpriseId = chat.getEnterpriseId();
ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService
.groupchatDetail3th(qwDTO.getThirdCorpid(), config.getWxSuiteid(), chat.getWxChatId(), 1);
ServiceResponse<GroupChatDetailDTO> detailResp = null ;
if(qwDTO.isSelf()) {
detailResp = this.qywxChatApiService
.groupchatDetail(qwDTO.getThirdCorpid(), qwDTO.getSelfSecret(), chat.getWxChatId(), 1);
}else {
detailResp = this.qywxChatApiService
.groupchatDetail3th(qwDTO.getThirdCorpid(), config.getWxSuiteid(), chat.getWxChatId(), 1);
}
logger.info("从企微获取群详情{}={}", chat.getWxChatId(), JSON.toJSON(detailResp));
if (!detailResp.isSuccess()) {
logger.info("从企微获取群详情失败");
......@@ -1092,8 +1104,14 @@ public class GroupChatServiceImpl implements GroupChatService {
}
List<TabGroupChat> list = this.groupChatMapper.listByIdSet(new HashSet<>(groupChatIdList));
List<String> wxChatIdList = list.stream().map(dto -> dto.getWxChatId()).collect(Collectors.toList());
ServiceResponse<List<FailChatListDTO>> resp = this.qywxChatApiService.transfer(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), wxChatIdList, userid);
ServiceResponse<List<FailChatListDTO>> resp = null ;
if(qwDTO.isSelf()) {
resp = this.qywxChatApiService.transferSelf(qwDTO.getThirdCorpid(),
qwDTO.getSelfSecret(), wxChatIdList, userid);
}else {
resp = this.qywxChatApiService.transfer(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), wxChatIdList, userid);
}
logger.info("群继承,继承人={}", JSON.toJSONString(resp), userid);
if (!resp.isSuccess()) {
return ServiceResponse.failure("9999", resp.getMessage());
......
......@@ -107,8 +107,14 @@ public class QywxSendServiceImpl implements QywxSendService {
messageDTO.setSenderUserId(tabHaobanStaff.getWxUserId());
}
// 调接口执行创建群发
JSONResponse respon = qywxSuiteApiService.sendExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
messageDTO);
JSONResponse respon = null ;
if(qwDTO.isSelf()) {
respon = qywxSuiteApiService.sendExternalMessageSelf(qwDTO.getThirdCorpid(), qwDTO.getSelfSecret(),
messageDTO);
}else {
respon = qywxSuiteApiService.sendExternalMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(),
messageDTO);
}
log.info("群发返回={}", JSON.toJSONString(respon));
Map<String, Object> returnMap = respon.getReturnMap();
String msgIdKey = "msgid";
......
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