Commit 8c2aea9d by 徐高华

自建-活码

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