Commit 8c2aea9d by 徐高华

自建-活码

parent 11f5fe7a
......@@ -18,6 +18,7 @@ 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;
......@@ -58,16 +59,10 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
private void del(TabHmQrcodeTemp item) {
try {
String suiteId = config.getWxSuiteid();
String corpid = item.getCorpid();
String configId = item.getWxConfigId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(item.getWxEnterpriseId());
QywxResponseDTO resp = null ;
if(qwDTO.isSelf()) {
resp = qywxUserApiService.delContactWaySelf(qwDTO.getDkCorpid() ,qwDTO.getSelfSecret(), configId);
}else {
resp = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), suiteId, configId);
}
QywxResponseDTO resp = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), configId,qwDTO.isSelf(),qwDTO.getUrlHost());
log.info("删除临时活码={}{},返回={}", configId, corpid, JSON.toJSONString(resp));
this.hmQrcodeTempMapper.deleteByPrimaryKey(item.getId());
} catch (Exception e) {
......
......@@ -30,6 +30,7 @@ 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;
......@@ -437,12 +438,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} else {
userIds.add(relationDTO.getQwUserId());
}
QywxExternalcontactResultDTO configResp = null ;
if(qwDTO.isSelf()) {
configResp = qywxUserApiService.addContactWaySelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), send);
}else {
configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), send);
}
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), send,qwDTO.isSelf(),qwDTO.getUrlHost());
logger.info("configId:{}", JSON.toJSONString(configResp));
String configId = configResp.getConfig_id();
if (StringUtils.isBlank(configId)) {
......
package com.gic.haoban.manage.service.service.out.impl.hm;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.errCode.HaoBanErrCodeCommon;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.PageUtil;
......
......@@ -61,6 +61,7 @@ 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;
......@@ -540,12 +541,7 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
paramsDTO.setUser(Arrays.asList(tabHaobanStaff.getWxUserId()));
}
}
QywxExternalcontactResultDTO wxResp = null ;
if(qwDTO.isSelf()) {
wxResp = qywxUserApiService.addContactWaySelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), paramsDTO);
}else {
wxResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), paramsDTO);
}
QywxExternalcontactResultDTO wxResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), 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()) {
......
......@@ -60,6 +60,7 @@ 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;
......@@ -152,19 +153,13 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
qywxExternalcontactDTO.setRemark(hmQrcodeQDTO.getName());
qywxExternalcontactDTO.setSkipVerify(hmQrcodeQDTO.getPassFlag() == 1);
qywxExternalcontactDTO.setState("HM" + hmId);
String corpid = qwDTO.getThirdCorpid();
List<String> userIds = staffClerkRelationService.listWxUserIdByClerkIds(clerkIdList, wxEnterpriseId);
if (CollectionUtils.isEmpty(userIds)) {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办");
}
qywxExternalcontactDTO.setUser(userIds);
logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO));
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = null ;
if(qwDTO.isSelf()) {
qywxExternalcontactResultDTO = qywxUserApiService.addContactWaySelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), qywxExternalcontactDTO);
}else {
qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(corpid, config.getWxSuiteid(), qywxExternalcontactDTO);
}
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), qywxExternalcontactDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
if (qywxExternalcontactResultDTO.getErrcode() != 0) {
GicLogRecordEvaluationContext.noWriteLog();
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), "创建企微活码失败,具体失败原因请参考企微报错http链接:" + qywxExternalcontactResultDTO.getErrmsg());
......@@ -347,12 +342,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办");
}
qywxExternalcontactDTO.setUser(userIds);
QywxResponseDTO qywxResponseDTO = null ;
if(qwDTO.isSelf()) {
qywxResponseDTO = qywxUserApiService.updateContactWaySelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), qywxExternalcontactDTO);
}else {
qywxResponseDTO = qywxUserApiService.updateContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
}
QywxResponseDTO qywxResponseDTO = qywxUserApiService.updateContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), qywxExternalcontactDTO,qwDTO.isSelf(),qwDTO.getUrlHost());
if (qywxResponseDTO.getErrcode() != 0) {
logger.error("更新企微活码失败");
GicLogRecordEvaluationContext.noWriteLog();
......@@ -702,12 +692,7 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
String wxConfigId = hmQrcodeBO.getWxConfigId();
if (StringUtils.isNotBlank(wxConfigId)) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(hmQrcodeBO.getWxEnterpriseId());
QywxResponseDTO qywxResponseDTO = null ;
if(qwDTO.isSelf()) {
qywxResponseDTO = qywxUserApiService.delContactWaySelf(qwDTO.getDkCorpid() ,qwDTO.getSelfSecret(), wxConfigId);
}else {
qywxResponseDTO = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxConfigId);
}
QywxResponseDTO qywxResponseDTO = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), QwUtils.getSecret(qwDTO, config.getWxSuiteid()), wxConfigId,qwDTO.isSelf(),qwDTO.getUrlHost());
int errcode = qywxResponseDTO.getErrcode();
//https://open.work.weixin.qq.com/devtool/query?e=41044
if (errcode != 0) {
......
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