Commit 6fccf647 by 徐高华

自建

parent bfe9d0c4
......@@ -11,10 +11,12 @@ import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.hm.HmQrcodeTempMapper;
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.wechat.api.dto.qywx.response.QywxResponseDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
......@@ -30,6 +32,8 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
private QywxUserApiService qywxUserApiService;
@Autowired
private Config config;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Override
public void save(HmQrcodeTempQO qo) {
......@@ -57,7 +61,13 @@ public class HmQrcodeTempServiceImpl implements HmQrcodeTempService {
String suiteId = config.getWxSuiteid();
String corpid = item.getCorpid();
String configId = item.getWxConfigId();
QywxResponseDTO resp = this.qywxUserApiService.delContactWay(corpid, suiteId, configId);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(item.getWxEnterpriseId());
QywxResponseDTO resp = null ;
if(qwDTO.getWxSecurityType()==5) {
resp = qywxUserApiService.delContactWaySelf(qwDTO.getDkCorpid() ,qwDTO.getSelfSecret(), configId);
}else {
resp = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), suiteId, configId);
}
log.info("删除临时活码={}{},返回={}", configId, corpid, JSON.toJSONString(resp));
this.hmQrcodeTempMapper.deleteByPrimaryKey(item.getId());
} catch (Exception e) {
......
......@@ -437,7 +437,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} else {
userIds.add(relationDTO.getQwUserId());
}
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), send);
QywxExternalcontactResultDTO configResp = null ;
if(qwDTO.getWxSecurityType()==5) {
configResp = qywxUserApiService.addContactWaySelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), send);
}else {
configResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), send);
}
logger.info("configId:{}", JSON.toJSONString(configResp));
String configId = configResp.getConfig_id();
if (StringUtils.isBlank(configId)) {
......
......@@ -540,8 +540,12 @@ public class HmLinkApiServiceImpl implements HmLinkApiService {
paramsDTO.setUser(Arrays.asList(tabHaobanStaff.getWxUserId()));
}
}
QywxExternalcontactResultDTO wxResp = qywxUserApiService.addContactWay(qwDTO.getThirdCorpid(),
config.getWxSuiteid(), paramsDTO);
QywxExternalcontactResultDTO wxResp = null ;
if(qwDTO.getWxSecurityType()==5) {
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(),
JSON.toJSONString(paramsDTO), JSON.toJSONString(wxResp));
if (null != wxResp && 0 == wxResp.getErrcode()) {
......
......@@ -159,7 +159,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
}
qywxExternalcontactDTO.setUser(userIds);
logger.info("新增活码参数:{}", JSON.toJSONString(qywxExternalcontactDTO));
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(corpid, config.getWxSuiteid(), qywxExternalcontactDTO);
QywxExternalcontactResultDTO qywxExternalcontactResultDTO = null ;
if(qwDTO.getWxSecurityType()==5) {
qywxExternalcontactResultDTO = qywxUserApiService.addContactWaySelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), qywxExternalcontactDTO);
}else {
qywxExternalcontactResultDTO = qywxUserApiService.addContactWay(corpid, config.getWxSuiteid(), qywxExternalcontactDTO);
}
if (qywxExternalcontactResultDTO.getErrcode() != 0) {
GicLogRecordEvaluationContext.noWriteLog();
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_0.getCode()), "创建企微活码失败,具体失败原因请参考企微报错http链接:" + qywxExternalcontactResultDTO.getErrmsg());
......@@ -342,7 +347,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
return ServiceResponse.failure(Convert.toStr(HaoBanErrCodeCommon.ERR_8.getCode()), "导购未关联好办");
}
qywxExternalcontactDTO.setUser(userIds);
QywxResponseDTO qywxResponseDTO = qywxUserApiService.updateContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
QywxResponseDTO qywxResponseDTO = null ;
if(qwDTO.getWxSecurityType()==5) {
qywxResponseDTO = qywxUserApiService.updateContactWaySelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), qywxExternalcontactDTO);
}else {
qywxResponseDTO = qywxUserApiService.updateContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), qywxExternalcontactDTO);
}
if (qywxResponseDTO.getErrcode() != 0) {
logger.error("更新企微活码失败");
GicLogRecordEvaluationContext.noWriteLog();
......@@ -692,7 +702,12 @@ 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(), config.getWxSuiteid(), wxConfigId);
QywxResponseDTO qywxResponseDTO = null ;
if(qwDTO.getWxSecurityType()==5) {
qywxResponseDTO = qywxUserApiService.delContactWaySelf(qwDTO.getDkCorpid() ,qwDTO.getSelfSecret(), wxConfigId);
}else {
qywxResponseDTO = qywxUserApiService.delContactWay(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxConfigId);
}
int errcode = qywxResponseDTO.getErrcode();
//https://open.work.weixin.qq.com/devtool/query?e=41044
if (errcode != 0) {
......@@ -817,7 +832,12 @@ public class HmQrcodeApiServiceImpl implements HmQrcodeApiService {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
//查询出所有正常的导购
//企微已经开启联系我
List<String> wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid());
List<String> wxUserIdsList = null ;
if(qwDTO.getWxSecurityType()==5) {
wxUserIdsList = qywxUserApiService.listCorpExternalUserSelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret());
}else {
wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid());
}
this.staffService.updateOpenConcatFlag(wxUserIdsList,qwDTO.needOpenUserId3th()?1:0) ;
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listIdsByWxUserIds(wxUserIdsList, wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
......
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