Commit 973b0041 by 徐高华

自建

parent 0e4ffc0b
......@@ -32,7 +32,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
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.util.QwUtils;
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;
......@@ -129,7 +128,7 @@ 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(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), userIdList, time, time , qwDTO.isSelf() , qwDTO.getUrlHost());
ServiceResponse<List<GroupChatQwDataDTO>> resp = this.qywxChatApiService.statistic(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), userIdList, time, time , qwDTO.isSelf() , qwDTO.getUrlHost());
List<GroupChatQwDataDTO> dataList = resp.getResult();
if (CollectionUtils.isEmpty(dataList)) {
if (list.size() < pageSize) {
......
......@@ -68,7 +68,6 @@ import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
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.util.QwUtils;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.service.MemberService;
import com.gic.mq.sdk.GicMQClient;
......@@ -532,7 +531,7 @@ public class GroupChatServiceImpl implements GroupChatService {
boolean syncDetailFlag) {
logger.info("同步群列表={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor);
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList(qwDTO.getThirdCorpid(),
QwUtils.getSecret(qwDTO, config.getWxSuiteid()) , userIdList, limit, cursor , qwDTO.isSelf(), qwDTO.getUrlHost());
qwDTO.getSelf3thSecret() , userIdList, limit, cursor , qwDTO.isSelf(), qwDTO.getUrlHost());
if (!resp.isSuccess()) {
logger.info("拉取群列表异常={}", JSON.toJSON(resp));
return;
......@@ -616,7 +615,7 @@ public class GroupChatServiceImpl implements GroupChatService {
String wxEnterpriseId = chat.getWxEnterpriseId();
String enterpriseId = chat.getEnterpriseId();
ServiceResponse<GroupChatDetailDTO> detailResp = this.qywxChatApiService
.groupchatDetail(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), chat.getWxChatId(), 1 , qwDTO.isSelf() , qwDTO.getUrlHost());
.groupchatDetail(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), chat.getWxChatId(), 1 , qwDTO.isSelf() , qwDTO.getUrlHost());
logger.info("从企微获取群详情{}={}", chat.getWxChatId(), JSON.toJSON(detailResp));
if (!detailResp.isSuccess()) {
......@@ -1095,7 +1094,7 @@ 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(),
QwUtils.getSecret(qwDTO, config.getWxSuiteid()), wxChatIdList, userid,qwDTO.isSelf(),qwDTO.getUrlHost());
qwDTO.getSelf3thSecret(), wxChatIdList, userid,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("群继承,继承人={}", JSON.toJSONString(resp), userid);
if (!resp.isSuccess()) {
return ServiceResponse.failure("9999", resp.getMessage());
......
......@@ -14,7 +14,6 @@ import com.gic.haoban.manage.service.pojo.bo.content.context.MaterialReportConte
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.util.DrawImageUtils;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.dto.qywx.QywxNewsArticleMessageDTO;
import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO;
import lombok.extern.slf4j.Slf4j;
......@@ -186,7 +185,7 @@ public class MaterialReportBuilder {
newsSendMessage.setAgentId(Integer.parseInt(wxEnterpriseQwDTO.getAgentId()));
newsSendMessage.setUserIds(Collections.singletonList(wxUserId));
QywxNewsArticleMessageDTO articleInfo = new QywxNewsArticleMessageDTO();
articleInfo.setAppid(QwUtils.getHbAppid(wxEnterpriseQwDTO, config.getAppid()));
articleInfo.setAppid(wxEnterpriseQwDTO.getHbWxaAppid());
articleInfo.setTitle(context.getMessageTitle());
articleInfo.setDescription(context.getMessageDesc());
articleInfo.setPagepath(NoticeMessageUtil.buildMiniAppUrl(NoticeMessageTypeEnum.MATERIAL_REPORT_NOTIFY, context.extendParams(context.getMainStoreId())));
......
......@@ -16,7 +16,6 @@ import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.notify.NoticeMessageService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
......@@ -192,7 +191,7 @@ public class PotentialCustomerNotifyBuilder {
}
QywxXcxSendMessageDTO messageDTO = this.buildApplicationMessage(staffClerkRelation, wxEnterpriseQwDTO,
customerStaticsBOMap.get(staffClerkRelation.getClerkId()).getNum(), context.buildExtendParams(staffClerkRelation.getStoreId(), staffClerkRelation.getClerkId()));
boolean sendMessage = qywxSuiteApiService.sendMessage(wxEnterpriseQwDTO.getThirdCorpid(), QwUtils.getSecret(wxEnterpriseQwDTO, config.getWxSuiteid()), messageDTO,wxEnterpriseQwDTO.isSelf(),wxEnterpriseQwDTO.getUrlHost());
boolean sendMessage = qywxSuiteApiService.sendMessage(wxEnterpriseQwDTO.getThirdCorpid(), wxEnterpriseQwDTO.getSelf3thSecret(), messageDTO,wxEnterpriseQwDTO.isSelf(),wxEnterpriseQwDTO.getUrlHost());
log.info("发送销售线索应用消息结果 {}", sendMessage);
}
}
......@@ -210,7 +209,7 @@ public class PotentialCustomerNotifyBuilder {
itemDTO.setValue(String.format("新增%s个客户的销售线索,请及时跟进", count));
ArrayList<String> list = new ArrayList<>();
list.add(wxUserId);
messageDTO.setAppid(QwUtils.getHbAppid(wxEnterpriseQwDTO, config.getAppid()));
messageDTO.setAppid(wxEnterpriseQwDTO.getHbWxaAppid());
messageDTO.setUserIds(list);
messageDTO.setPage(NoticeMessageUtil.buildMiniAppUrl(NoticeMessageTypeEnum.POTENTIAL_CUSTOMER_NOTIFY, extendParams));
messageDTO.setTitle("销售线索通知");
......
......@@ -40,7 +40,6 @@ import com.gic.haoban.manage.service.service.content.ClerkShareLogService;
import com.gic.haoban.manage.service.service.content.GroupMessageService;
import com.gic.haoban.manage.service.service.content.TriggerCustomerDetailService;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialEnterpriseAdaptor;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.dto.qdto.group.QywxGroupMessageQDTO;
import com.gic.wechat.api.dto.qdto.group.QywxGroupMsgSendResultQDTO;
import com.gic.wechat.api.dto.qdto.group.QywxMomentInfoQDTO;
......@@ -410,7 +409,7 @@ public class GroupMessageServiceImpl implements GroupMessageService {
groupMessageQDTO.setCorpid(corpid);
groupMessageQDTO.setStartTime(startTime.getTime() / 1000);
groupMessageQDTO.setEndTime(endTime.getTime() / 1000);
groupMessageQDTO.setSuiteid(QwUtils.getSecret(qwDTO, config.getWxSuiteid()));
groupMessageQDTO.setSuiteid(qwDTO.getSelf3thSecret());
groupMessageQDTO.setChatType(groupMsgChatType.getCode());
groupMessageQDTO.setPageSize(100);
ServiceResponse<QywxGroupMsgResp> serviceResponse =
......@@ -451,7 +450,7 @@ public class GroupMessageServiceImpl implements GroupMessageService {
private List<QywxGroupMsgSendResultDTO.GroupMsgSendResultInfo> queryGroupMsgSendResult(String corpid, String msgId, String userId, String cursor , WxEnterpriseQwDTO qwDTO) {
QywxGroupMsgSendResultQDTO searchQDTO = new QywxGroupMsgSendResultQDTO();
searchQDTO.setCorpid(corpid);
searchQDTO.setSuiteid(QwUtils.getSecret(qwDTO, config.getWxSuiteid()));
searchQDTO.setSuiteid(qwDTO.getSelf3thSecret());
searchQDTO.setPageSize(1000);
searchQDTO.setMsgId(msgId);
searchQDTO.setUserId(userId);
......@@ -481,7 +480,7 @@ public class GroupMessageServiceImpl implements GroupMessageService {
QywxMomentInfoQDTO qywxMomentInfoQDTO = new QywxMomentInfoQDTO();
qywxMomentInfoQDTO.setCorpid(corpid);
qywxMomentInfoQDTO.setSuiteid(QwUtils.getSecret(qwDTO, config.getWxSuiteid()));
qywxMomentInfoQDTO.setSuiteid(qwDTO.getSelf3thSecret());
qywxMomentInfoQDTO.setStartTime(DateUtil.addNumForSecond(createTime, -60).getTime() / 1000);
qywxMomentInfoQDTO.setEndTime((createTime.getTime() / 1000) + 10);
qywxMomentInfoQDTO.setCreatorId(userId);
......@@ -505,7 +504,7 @@ public class GroupMessageServiceImpl implements GroupMessageService {
public List<String> queryMomentSendResultList(String corpid, String userId, String momentId, WxEnterpriseQwDTO qwDTO) {
QywxMomentSendResultQDTO qywxMomentSendResultQDTO = new QywxMomentSendResultQDTO();
qywxMomentSendResultQDTO.setCorpid(corpid);
qywxMomentSendResultQDTO.setSuiteid(QwUtils.getSecret(qwDTO, config.getWxSuiteid()));
qywxMomentSendResultQDTO.setSuiteid(qwDTO.getSelf3thSecret());
qywxMomentSendResultQDTO.setMomentId(momentId);
qywxMomentSendResultQDTO.setUserId(userId);
qywxMomentSendResultQDTO.setPageSize(1000);
......
......@@ -13,7 +13,6 @@ import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.content.MaterialReportService;
import com.gic.haoban.manage.service.service.content.adaptor.MaterialReportBuilder;
import com.gic.haoban.manage.service.service.notify.NoticeMessageService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.dto.qywx.QywxNewsSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import lombok.extern.slf4j.Slf4j;
......@@ -98,7 +97,7 @@ public class MaterialReportServiceImpl implements MaterialReportService {
return;
}
log.info("发送企业图文消息参数{}", JSON.toJSONString(newsSendMessageDTO));
boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), newsSendMessageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
boolean result = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), newsSendMessageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("成员{}发送素材企微使用报告结果 {}", staffId, result);
}
}
......@@ -18,7 +18,6 @@ import com.gic.haoban.manage.service.entity.hm.TabHmQrcodeTemp;
import com.gic.haoban.manage.service.pojo.qo.HmQrcodeTempQO;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
......@@ -62,7 +61,7 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
String corpid = item.getCorpid();
String configId = item.getWxConfigId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(item.getWxEnterpriseId());
QywxResponseDTO resp = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), configId,qwDTO.isSelf(),qwDTO.getUrlHost());
QywxResponseDTO resp = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), configId,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("删除临时活码={}{},返回={}", configId, corpid, JSON.toJSONString(resp));
this.hmQrcodeTempMapper.deleteByPrimaryKey(item.getId());
} catch (Exception e) {
......
......@@ -27,8 +27,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanMaterial;
import com.gic.haoban.manage.service.entity.TabMaterialContent;
import com.gic.haoban.manage.service.service.MaterialService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.CommonUtil;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.enums.QywxMediaTypeEnum;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.weimob.common.Md5Util;
......@@ -228,10 +226,10 @@ public class MaterialServiceImpl implements MaterialService {
url+= "?imageView2/2/w/1440/h/1080" ;
logger.info("url={}",url);
}
jp = qywxSuiteApiService.uploadAttachment(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost());
jp = qywxSuiteApiService.uploadAttachment(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost());
}else {
// 群发上传
jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost());
jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode() , selfFlag , qwDTO.getUrlHost());
}
if (jp.getErrorCode() == 0) {
if(from==1) {
......
......@@ -26,7 +26,6 @@ import com.gic.haoban.manage.service.service.MaterialService;
import com.gic.haoban.manage.service.service.QywxSendService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.dto.qywx.QywxExternalMessageDTO;
import com.gic.wechat.api.dto.qywx.QywxImageMaterialDTO;
import com.gic.wechat.api.dto.qywx.QywxLinkMaterialDTO;
......@@ -161,7 +160,7 @@ public class QywxSendServiceImpl implements QywxSendService {
range.setSender_list(senderList);
moment.setVisible_range(range);
ServiceResponse<String> resp = this.qywxExternalUserService.addMomentTask(qwDTO.getThirdCorpid(),
QwUtils.getSecret(qwDTO, config.getWxSuiteid()), moment,qwDTO.isSelf(),qwDTO.getUrlHost());
qwDTO.getSelf3thSecret(), moment,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("朋友圈消息={},返回={}", JSON.toJSONString(moment), JSON.toJSONString(resp));
return resp;
}
......
......@@ -49,7 +49,6 @@ import com.gic.haoban.manage.service.service.WelcomeSendService;
import com.gic.haoban.manage.service.service.WelcomeService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.mq.sdk.GicMQClient;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalMessageBaseDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxFileExternalBaseDTO;
......@@ -260,7 +259,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
String mediaUrl = media.getMediaUrl();
String[] arr = mediaUrl.split("/");
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(corpid, QwUtils.getSecret(qwDTO, config.getWxSuiteid()),
JSONResponse jp = qywxSuiteApiService.uploadMedia(corpid, qwDTO.getSelf3thSecret(),
mediaUrl, arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(),selfFlag,qwDTO.getUrlHost());
log.info("欢迎语发送图片返回:{}", JSON.toJSONString(jp));
if (jp.getErrorCode() == 0) {
......@@ -274,7 +273,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
String mediaUrl = media.getMediaUrl();
String[] arr = mediaUrl.split("/");
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(corpid, QwUtils.getSecret(qwDTO, config.getWxSuiteid()),
JSONResponse jp = qywxSuiteApiService.uploadMedia(corpid, qwDTO.getSelf3thSecret(),
mediaUrl, arr[arr.length - 1], QywxMediaTypeEnum.VIDEO.getCode(),selfFlag,qwDTO.getUrlHost());
log.info("欢迎语发送视频返回:{}", JSON.toJSONString(jp));
if (jp.getErrorCode() == 0) {
......@@ -288,7 +287,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
String mediaUrl = media.getMediaUrl();
String[] arr = mediaUrl.split("/");
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(corpid, QwUtils.getSecret(qwDTO, config.getWxSuiteid()),
JSONResponse jp = qywxSuiteApiService.uploadMedia(corpid, qwDTO.getSelf3thSecret(),
mediaUrl, arr[arr.length - 1], QywxMediaTypeEnum.FILE.getCode(),selfFlag,qwDTO.getUrlHost());
log.info("欢迎语发送文件返回:{}", JSON.toJSONString(jp));
if (jp.getErrorCode() == 0) {
......@@ -361,7 +360,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
String downloadUrl = qRcodePic.getPicUploadResDTO().downloadUrl;
String[] arr = downloadUrl.split("/");
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(corpid, QwUtils.getSecret(qwDTO, config.getWxSuiteid()),
JSONResponse jp = qywxSuiteApiService.uploadMedia(corpid, qwDTO.getSelf3thSecret(),
downloadUrl, arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(),selfFlag,qwDTO.getUrlHost());
log.info("欢迎语发送带参数的公众号企微二维码返回:{}", JSON.toJSONString(jp));
if (jp.getErrorCode() == 0) {
......
package com.gic.haoban.manage.service.service.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
......@@ -21,6 +20,7 @@ import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.SecretSettingMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper;
......@@ -46,6 +46,8 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
private TabHaobanStaffClerkRelationMapper tabHaobanStaffClerkRelationMapper ;
@Autowired
private SecretSettingMapper secretSettingMapper;
@Autowired
private Config config;
@Override
public String add(WxEnterpriseDTO wxDTO) {
......@@ -114,10 +116,28 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
qw.setAgentName(secret.getAgentName());
qw.setSelfAppid(wxEnterprise.getWxaAppid());
}
qw.setHbWxaAppid(this.getHbAppid(qw, config.getAppid()));
qw.setSelf3thSecret(this.getSecret(qw, config.getWxSuiteid()));
logger.info("企微所有corpid信息={}",JSON.toJSON(qw));
return qw;
}
public String getSecret(WxEnterpriseQwDTO qwDTO, String suiteId) {
String secret = suiteId;
if (qwDTO.isSelf()) {
secret = qwDTO.getSelfSecret();
}
return secret;
}
public String getHbAppid(WxEnterpriseQwDTO qwDTO, String thirdAppid) {
String appid = thirdAppid;
if (qwDTO.isSelf()) {
appid = qwDTO.getSelfAppid();
}
return appid;
}
@Override
public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) {
if (StringUtils.isBlank(corpId)) {
......
......@@ -51,7 +51,6 @@ import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.notify.NoticeMessageService;
import com.gic.haoban.manage.service.service.notify.NoticeMessageTemplateService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
......@@ -266,14 +265,14 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
appUrl += messageTypeEnum.getPageType();
}
appUrl += "&data=" + data;
messageDTO.setAppid(QwUtils.getHbAppid(qwDTO, config.getAppid()));
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setAgentId(Integer.parseInt(qwDTO.getAgentId()));
messageDTO.setAgentName(qwDTO.getAgentName());
messageDTO.setUserIds(wxUserIdList);
messageDTO.setPage(appUrl);
messageDTO.setTitle(StringUtils.isNotBlank(title)?title: messageTypeEnum.getName());
messageDTO.setContent(contentList.get(0).getVal());
boolean sendMessage = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
boolean sendMessage = qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
NotifyMessageMQDTO mqdto = new NotifyMessageMQDTO();
List<String> clerkIdList = list.stream().map(StaffClerkRelationDTO::getClerkId).collect(Collectors.toList());
mqdto.setClerkIdList(clerkIdList);
......@@ -419,11 +418,11 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
List<String> userList = new ArrayList<>();
userList.add(wxUserId);
messageDTO.setAppid(QwUtils.getHbAppid(qwDTO, config.getAppid()));
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(userList);
messageDTO.setPage(appUrl);
messageDTO.setTitle(StringUtils.isNotBlank(title)?title:messageTypeEnum.getName());
messageDTO.setItems(items);
qywxSuiteApiService.sendMessage(corpid, QwUtils.getSecret(qwDTO, config.getWxSuiteid()), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
qywxSuiteApiService.sendMessage(corpid, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
}
}
......@@ -105,7 +105,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
String cursor = null;
do {
//离职成员客户列表
unassignedListDTO = qywxUserApiService.getUnassignedList(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), cursor , qwDTO.isSelf(),qwDTO.getUrlHost());
unassignedListDTO = qywxUserApiService.getUnassignedList(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), cursor , qwDTO.isSelf(),qwDTO.getUrlHost());
cursor = unassignedListDTO.getNextCursor();
if (CollectionUtils.isNotEmpty(unassignedListDTO.getInfo())) {
ret.addAll(unassignedListDTO.getInfo());
......@@ -146,7 +146,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
logger.info("takeover is null={}",dto.getTakeoverStaffId());
return;
}
QywxTransferCustomerDTO customerDTO = qywxUserApiService.transferResult(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), handover.getWxUserId(), takeover.getWxUserId(), true , qwDTO.isSelf() , qwDTO.getUrlHost());
QywxTransferCustomerDTO customerDTO = qywxUserApiService.transferResult(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), handover.getWxUserId(), takeover.getWxUserId(), true , qwDTO.isSelf() , qwDTO.getUrlHost());
if (customerDTO.getErrcode() != 0) {
return;
}
......@@ -256,7 +256,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
for (Map.Entry<String, List<String>> entry : handoverStaffExternalMap.entrySet()) {
String wxUserId = entry.getKey();
List<String> list = entry.getValue();
QywxTransferCustomerDTO transferCustomerResp = qywxUserApiService.transferCustomer(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), wxUserId, takeoverUserId, list,qwDTO.isSelf(),qwDTO.getUrlHost());
QywxTransferCustomerDTO transferCustomerResp = qywxUserApiService.transferCustomer(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), wxUserId, takeoverUserId, list,qwDTO.isSelf(),qwDTO.getUrlHost());
if (transferCustomerResp.getErrcode() != 0) {
logger.info("转移异常");
}
......
......@@ -42,7 +42,6 @@ import com.gic.haoban.manage.service.service.MaterialService;
import com.gic.haoban.manage.service.service.MiniprogramSettingService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.CommonUtil;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.enums.QywxMediaTypeEnum;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.github.pagehelper.PageHelper;
......@@ -148,7 +147,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
if (type == 3) {
String imgUrl = materialDTO.getImgUrl();
logger.info("【上传图片】imgUrl={}", imgUrl);
JSONResponse response = qywxSuiteApiService.uploadImage(qwDTO.getThirdCorpid() , QwUtils.getSecret(qwDTO, config.getWxSuiteid()), imgUrl , qwDTO.isSelf(),qwDTO.getUrlHost());
JSONResponse response = qywxSuiteApiService.uploadImage(qwDTO.getThirdCorpid() , qwDTO.getSelf3thSecret(), imgUrl , qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("【上传图片返回】response={}", JSON.toJSONString(response));
String wxImgUrl = response.getResult() == null ? "" : response.getResult().toString();
materialDTO.setWxImgUrl(wxImgUrl);
......@@ -157,7 +156,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
String[] arr = url.split("/");
int count = arr.length;
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid() , QwUtils.getSecret(qwDTO, config.getWxSuiteid()), url, arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid() , qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) {
materialDTO.setWxLastUploadTime(new Date());
materialDTO.setMediaId(jp.getResult().toString());
......@@ -234,7 +233,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
String imgUrl = materialDTO.getImgUrl();
String oldImgUrl = materialDTO.getImgUrl();
if (!imgUrl.equals(oldImgUrl)) {
JSONResponse response = qywxSuiteApiService.uploadImage(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), imgUrl ,qwDTO.isSelf(),qwDTO.getUrlHost());
JSONResponse response = qywxSuiteApiService.uploadImage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), imgUrl ,qwDTO.isSelf(),qwDTO.getUrlHost());
String wxImgUrl = response.getResult() == null ? "" : response.getResult().toString();
materialDTO.setWxImgUrl(wxImgUrl);
}
......@@ -243,7 +242,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
String[] arr = url.split("/");
int count = arr.length;
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), url , arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url , arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) {
materialDTO.setWxLastUploadTime(new Date());
materialDTO.setMediaId(jp.getResult().toString());
......@@ -292,7 +291,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
}
String[] arr = url.split("/");
int count = arr.length;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), url, arr[count - 1], fileType.getCode(),qwDTO.isSelf(),qwDTO.getUrlHost());
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode(),qwDTO.isSelf(),qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) {
old.setWxLastUploadTime(new Date());
old.setMediaId(jp.getResult().toString());
......@@ -469,7 +468,7 @@ public class MaterialApiServiceImpl implements MaterialApiService {
QywxMediaTypeEnum fileType = QywxMediaTypeEnum.IMAGE;
int count = arr.length;
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(corPid, QwUtils.getSecret(qwDTO, config.getWxSuiteid()), url, arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
JSONResponse jp = qywxSuiteApiService.uploadMedia(corPid, qwDTO.getSelf3thSecret(), url, arr[count - 1], fileType.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) {
return jp.getResult().toString();
}
......
......@@ -95,7 +95,6 @@ import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.hm.HmLinkService;
import com.gic.haoban.manage.service.service.hm.WxUserAddLogService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.member.api.dto.MemberDTO;
import com.gic.member.api.dto.MemberSimpleDetailDTO;
import com.gic.member.api.dto.MemberSourceDetailDTO;
......@@ -1112,7 +1111,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if (qwDTO == null) {
return null;
}
return qywxSuiteApiService.taskExternalMessage(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), wxMessageId, cursor ,qwDTO.isSelf(),qwDTO.getUrlHost());
return qywxSuiteApiService.taskExternalMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), wxMessageId, cursor ,qwDTO.isSelf(),qwDTO.getUrlHost());
}
/**
......@@ -1145,7 +1144,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if (qwDTO == null) {
return null;
}
return qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), wxMessageId , qwDTO.isSelf(),qwDTO.getUrlHost());
return qywxSuiteApiService.resultExternalMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), wxMessageId , qwDTO.isSelf(),qwDTO.getUrlHost());
}
@Override
......
......@@ -63,7 +63,6 @@ import com.gic.haoban.manage.service.service.WxApplicationService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.member.api.dto.es.MemberDataDTO;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
......@@ -596,7 +595,7 @@ public class MessageApiServiceImpl implements MessageApiService {
if (qwDTO.needOpenUserId3th()) {
wxUserId = staff.getWxOpenUseId();
}
messageDTO.setAppid(QwUtils.getHbAppid(qwDTO, config.getAppid()));
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(Arrays.asList(wxUserId));
messageDTO.setPage(
NoticeMessageTypeEnum.OFFLINE_PRE.getPageUrl() + NoticeMessageTypeEnum.OFFLINE_PRE.getPageType());
......@@ -605,7 +604,7 @@ public class MessageApiServiceImpl implements MessageApiService {
map.put("事件", message);
List<ItemDTO> items = getItemsList(map);
messageDTO.setItems(items);
qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
return com.gic.api.base.commons.ServiceResponse.success();
}
......
......@@ -20,7 +20,6 @@ import com.gic.haoban.manage.service.entity.TabMiniprogramSetting;
import com.gic.haoban.manage.service.service.MiniprogramSettingService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.CommonUtil;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.enums.QywxMediaTypeEnum;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
......@@ -64,7 +63,7 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService
String[] arr = miniprogramSetting.getImageUrl().split("/");
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(miniprogramSetting.getWxEnterpriseId()) ;
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), miniprogramSetting.getImageUrl(), arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(),selfFlag,qwDTO.getUrlHost());
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), miniprogramSetting.getImageUrl(), arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) {
miniprogramSetting.setMediaTime(date);
miniprogramSetting.setMediaId(jp.getResult().toString());
......@@ -119,7 +118,7 @@ public class MiniprogramSettingServiceImpl implements MiniprogramSettingService
String[] arr = miniprogramSetting.getImageUrl().split("/");
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
boolean selfFlag = qwDTO.isSelf() ;
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), miniprogramSetting.getImageUrl(), arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(),selfFlag,qwDTO.getUrlHost());
JSONResponse jp = qywxSuiteApiService.uploadMedia(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), miniprogramSetting.getImageUrl(), arr[arr.length - 1], QywxMediaTypeEnum.IMAGE.getCode(),selfFlag,qwDTO.getUrlHost());
if (jp.getErrorCode() == 0) {
miniprogramSetting.setMediaTime(date);
miniprogramSetting.setMediaId(jp.getResult().toString());
......
......@@ -20,7 +20,6 @@ import com.gic.haoban.manage.service.pojo.QywxSyncTagFormatPojo;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.QywxTagService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.member.api.dto.MemberTagDTO;
import com.gic.member.api.service.MemberTagService;
import com.gic.member.tag.api.dto.MemberTagItemDTO;
......@@ -94,7 +93,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.info("企业标签所在企业不存在");
return;
}
QywxGetCorpTagListDTO corpTagListResp = qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), null, -1 , qwDTO.isSelf(),qwDTO.getUrlHost());
QywxGetCorpTagListDTO corpTagListResp = qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), null, -1 , qwDTO.isSelf(),qwDTO.getUrlHost());
if (corpTagListResp.getErrcode() != 0) {
logger.info("企业微信标签有问题:{}", wxEnterpriseId);
return;
......@@ -221,7 +220,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagService.closeSync(wxEnterpriseId, memberTagId);
List<String> delIds = new ArrayList<>();
delIds.add(tabQywxTag.getQywxGroupKey());
QywxResponseDTO responseDTO = qywxSuiteApiService.delCorpTag(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), delIds, 0,qwDTO.isSelf(),qwDTO.getUrlHost());
QywxResponseDTO responseDTO = qywxSuiteApiService.delCorpTag(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), delIds, 0,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("关闭同步:{}", JSONObject.toJSONString(responseDTO));
if (responseDTO.getErrcode() != 0) {
resp.setMessage(responseDTO.getErrmsg());
......@@ -293,7 +292,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
logger.info("新增标签组无需操作:{}", callbackDTO.getTagId());
List<String> ids = new ArrayList<>();
ids.add(callbackDTO.getTagId());
QywxGetCorpTagListDTO tagDetail = qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), ids, QywxTagRelationTypeEnum.TAG_GROUP.getType() , qwDTO.isSelf(),qwDTO.getUrlHost());
QywxGetCorpTagListDTO tagDetail = qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), ids, QywxTagRelationTypeEnum.TAG_GROUP.getType() , qwDTO.isSelf(),qwDTO.getUrlHost());
if (tagDetail.getErrcode() != 0) {
logger.info("没有关联,无需操作:{}", JSONObject.toJSONString(tagDetail));
return;
......@@ -306,7 +305,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
//查找对应的标签组 如果标签组关联了
List<String> ids = new ArrayList<>();
ids.add(callbackDTO.getTagId());
QywxGetCorpTagListDTO tagDetail = qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), ids, QywxTagRelationTypeEnum.TAG_ITEM.getType() , qwDTO.isSelf(),qwDTO.getUrlHost());
QywxGetCorpTagListDTO tagDetail = qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), ids, QywxTagRelationTypeEnum.TAG_ITEM.getType() , qwDTO.isSelf(),qwDTO.getUrlHost());
if (tagDetail.getErrcode() != 0) {
logger.info("查询失败,无需操作:{}", JSONObject.toJSONString(tagDetail));
return;
......@@ -413,7 +412,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagDTO.setId(callbackDTO.getTagId());
qywxTagDTO.setName(qywxGroupKey.getQywxGroupName());
qywxTagDTO.setOrder(qywxGroupKey.getOrder());
qywxSuiteApiService.editCorpTagNameOrOrder(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), qywxTagDTO , qwDTO.isSelf(),qwDTO.getUrlHost());
qywxSuiteApiService.editCorpTagNameOrOrder(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), qywxTagDTO , qwDTO.isSelf(),qwDTO.getUrlHost());
//标签项
} else if (Objects.equals(relationTypeEnum.getTagType(), QywxTagRelationTypeEnum.TAG_ITEM.getTagType())) {
......@@ -433,7 +432,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagDTO.setId(callbackDTO.getTagId());
qywxTagDTO.setName(qywxTagItem.getQywxTagName());
qywxTagDTO.setOrder(qywxTagItem.getOrder());
qywxSuiteApiService.editCorpTagNameOrOrder(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), qywxTagDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
qywxSuiteApiService.editCorpTagNameOrOrder(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), qywxTagDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
}
}
......@@ -772,7 +771,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
qywxTagDTO.setId(renameQywxKey);
qywxTagDTO.setName(name);
qywxTagDTO.setOrder(order);
QywxResponseDTO responseDTO = qywxSuiteApiService.editCorpTagNameOrOrder(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), qywxTagDTO , qwDTO.isSelf(),qwDTO.getUrlHost());
QywxResponseDTO responseDTO = qywxSuiteApiService.editCorpTagNameOrOrder(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), qywxTagDTO , qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("同步名称:{}", JSONObject.toJSONString(responseDTO));
if (responseDTO.getErrcode() != 0) {
resp.setMessage(responseDTO.getErrmsg());
......@@ -855,7 +854,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relation.getWxEnterpriseId()) ;
List<String> ids = new ArrayList<>();
ids.add(tabQywxTag.getQywxGroupKey());
QywxGetCorpTagListDTO tagDetail = qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), ids, QywxTagRelationTypeEnum.TAG_GROUP.getType() , qwDTO.isSelf(),qwDTO.getUrlHost());
QywxGetCorpTagListDTO tagDetail = qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), ids, QywxTagRelationTypeEnum.TAG_GROUP.getType() , qwDTO.isSelf(),qwDTO.getUrlHost());
if (tagDetail.getErrcode() != 0) {
logger.info("查询失败,无需操作:{}", JSONObject.toJSONString(tagDetail));
ret.put("描述", "查询失败:" + tagDetail.getErrmsg());
......@@ -958,7 +957,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
}
TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpid) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterprise.getWxEnterpriseId()) ;
QywxResponseDTO responseDTO = qywxUserApiService.markTag(corpid, QwUtils.getSecret(qwDTO, config.getWxSuiteid()), wxUserId, externalUserId, needSetTagList, needDelTagList , qwDTO.isSelf() ,qwDTO.getUrlHost());
QywxResponseDTO responseDTO = qywxUserApiService.markTag(corpid, qwDTO.getSelf3thSecret(), wxUserId, externalUserId, needSetTagList, needDelTagList , qwDTO.isSelf() ,qwDTO.getUrlHost());
logger.info("操作返回:{}", JSONObject.toJSONString(responseDTO));
if (responseDTO.getErrcode() != 0) {
logger.info("权限不对,重试三次:{},{}", wxUserId, externalUserId);
......
......@@ -30,7 +30,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.task.RouterConstant;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.haoban.task.api.dto.MqMessageQo;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
......@@ -438,7 +437,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} else {
userIds.add(relationDTO.getQwUserId());
}
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), send,qwDTO.isSelf(),qwDTO.getUrlHost());
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), send,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("configId:{}", JSON.toJSONString(configResp));
String configId = configResp.getConfig_id();
if (StringUtils.isBlank(configId)) {
......
......@@ -37,7 +37,6 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
......@@ -252,14 +251,14 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
list.add(wxUserId);
TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpId);
WxEnterpriseQwDTO qwDTO =this.wxEnterpriseService.getQwInfo(wxEnterprise.getWxEnterpriseId()) ;
messageDTO.setAppid(QwUtils.getHbAppid(qwDTO, config.getAppid()));
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(list);
messageDTO.setPage(pageUrl);
messageDTO.setTitle(title);
messageDTO.setItems(items);
logger.info("发送参数为corpId============:{},suitId============:{},messageDTO============:{},", corpId, config.getWxSuiteid(), JSONObject.toJSONString(messageDTO));
boolean b = qywxSuiteApiService.sendMessage(corpId, QwUtils.getSecret(qwDTO, config.getWxSuiteid()), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
boolean b = qywxSuiteApiService.sendMessage(corpId, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("发送===============》{}", b);
return b;
}
......@@ -308,13 +307,13 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpId);
WxEnterpriseQwDTO qwDTO =this.wxEnterpriseService.getQwInfo(wxEnterprise.getWxEnterpriseId()) ;
messageDTO.setAppid(QwUtils.getHbAppid(qwDTO, config.getAppid()));
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(Collections.singletonList(wxUserId));
messageDTO.setTitle(title);
messageDTO.setItems(contentList);
messageDTO.setPage(pageUrl);
logger.info("消息发送, corpId : {}, suitId : {}, messageDTO : {}", corpId, config.getWxSuiteid(), JSONObject.toJSONString(messageDTO));
boolean sendResult = qywxSuiteApiService.sendMessage(corpId, QwUtils.getSecret(qwDTO, config.getWxSuiteid()), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
boolean sendResult = qywxSuiteApiService.sendMessage(corpId, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("消息发送结果, sendResult : {}", sendResult);
return sendResult;
}
......@@ -361,14 +360,14 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
list.add(wxUserId);
TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpId);
WxEnterpriseQwDTO qwDTO =this.wxEnterpriseService.getQwInfo(wxEnterprise.getWxEnterpriseId()) ;
messageDTO.setAppid(QwUtils.getHbAppid(qwDTO, config.getAppid()));
messageDTO.setAppid(qwDTO.getHbWxaAppid());
messageDTO.setUserIds(list);
messageDTO.setPage(pageUrl);
messageDTO.setTitle(title);
messageDTO.setItems(items);
logger.info("发送消息参数为corpId={},messageDTO={},", corpId, JSONObject.toJSONString(messageDTO));
boolean b = qywxSuiteApiService.sendMessage(corpId, QwUtils.getSecret(qwDTO, config.getWxSuiteid()), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
boolean b = qywxSuiteApiService.sendMessage(corpId, qwDTO.getSelf3thSecret(), messageDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("发送消息返回={}", b);
return b;
}
......
......@@ -61,7 +61,6 @@ import com.gic.haoban.manage.service.service.hm.HmLinkStoreService;
import com.gic.haoban.manage.service.service.hm.HmPageService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.member.api.dto.es.MemberDataDTO;
import com.gic.member.api.dto.es.MemberStoreClerkDataDTO;
import com.gic.member.api.service.MemberService;
......@@ -541,7 +540,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
paramsDTO.setUser(Arrays.asList(tabHaobanStaff.getWxUserId()));
}
}
QywxExternalcontactResultDTO wxResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), paramsDTO , qwDTO.isSelf(),qwDTO.getUrlHost());
QywxExternalcontactResultDTO wxResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), paramsDTO , qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("创建动态活码参数corpid={},app={},param={},返回={}", qwDTO.getThirdCorpid(), config.getWxSuiteid(),
JSON.toJSONString(paramsDTO), JSON.toJSONString(wxResp));
if (null != wxResp && 0 == wxResp.getErrcode()) {
......
......@@ -59,7 +59,6 @@ import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import com.gic.haoban.manage.service.service.impl.log.LogRecordAfterServiceImpl;
import com.gic.haoban.manage.service.util.QwFriendLimitCountUtil;
import com.gic.haoban.manage.service.util.QwUtils;
import com.gic.log.record.anno.GicLogRecord;
import com.gic.log.record.util.GicLogRecordCategoryEnum;
import com.gic.log.record.util.GicLogRecordEvaluationContext;
......@@ -158,7 +157,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
qywxExternalcontactDTO.setUser(userIds);
logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO));
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), qywxExternalcontactDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), qywxExternalcontactDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
if (qywxExternalcontactResultDTO.getErrcode() != 0) {
GicLogRecordEvaluationContext.noWriteLog();
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), "创建企微活码失败,具体失败原因请参考企微报错http链接:" + qywxExternalcontactResultDTO.getErrmsg());
......@@ -341,7 +340,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办");
}
qywxExternalcontactDTO.setUser(userIds);
QywxResponseDTO qywxResponseDTO = qywxUserApiService.updateContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), qywxExternalcontactDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
QywxResponseDTO qywxResponseDTO = qywxUserApiService.updateContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), qywxExternalcontactDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
if (qywxResponseDTO.getErrcode() != 0) {
logger.error("更新企微活码失败");
GicLogRecordEvaluationContext.noWriteLog();
......@@ -691,7 +690,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
String wxConfigId = hmQrcodeBO.getWxConfigId();
if (StringUtils.isNotBlank(wxConfigId)) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(hmQrcodeBO.getWxEnterpriseId());
QywxResponseDTO qywxResponseDTO = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), wxConfigId,qwDTO.isSelf(),qwDTO.getUrlHost());
QywxResponseDTO qywxResponseDTO = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), qwDTO.getSelf3thSecret(), wxConfigId,qwDTO.isSelf(),qwDTO.getUrlHost());
int errcode = qywxResponseDTO.getErrcode();
//https://open.work.weixin.qq.com/devtool/query?e=41044
if (errcode != 0) {
......
package com.gic.haoban.manage.service.util;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
public class QwUtils {
public static String getSecret(WxEnterpriseQwDTO qwDTO, String suiteId) {
String secret = suiteId;
if (qwDTO.isSelf()) {
secret = qwDTO.getSelfSecret();
}
return secret;
}
public static String getHbAppid(WxEnterpriseQwDTO qwDTO, String thirdAppid) {
String appid = thirdAppid;
if (qwDTO.isSelf()) {
appid = qwDTO.getSelfAppid();
}
return appid;
}
}
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