Commit a22a34f4 by 徐高华

自建

parent 8c2aea9d
......@@ -96,7 +96,7 @@ public class HandoverServiceImpl implements HandoverService {
Map<String, List<QywxUnassignedInfoDTO>> handoverUserMap = infoList.stream().collect(Collectors.groupingBy(dto -> dto.getHandoverUserid()));
handoverUserMap.forEach((userId, list) -> {
boolean checkFlag = checkStaffOver(secretSetting, userId, qwDTO.getDkCorpid());
boolean checkFlag = checkStaffOver(secretSetting, userId, qwDTO.getDkCorpid() ,qwDTO);
if (checkFlag) {
logger.info("该用户存在,不需要离职基础:{},{}", userId, wxEnterpriseId);
return;
......@@ -144,8 +144,8 @@ public class HandoverServiceImpl implements HandoverService {
return false;
}
private boolean checkStaffOver(SecretSettingDTO secretSetting, String userId, String corpId) {
UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpId, secretSetting.getSecretVal(), userId);
private boolean checkStaffOver(SecretSettingDTO secretSetting, String userId, String corpId,WxEnterpriseQwDTO qwDTO) {
UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpId, secretSetting.getSecretVal(), userId , qwDTO.getUrlHost());
if (null == user) {
return false;
}
......
......@@ -147,7 +147,7 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
}
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null != secretSetting && StringUtils.isNotBlank(secretSetting.getSecretVal())) {
UserDTO user = qywxUserApiService.getSelfWorkWxUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId);
UserDTO user = qywxUserApiService.getSelfWorkWxUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId, qwDTO.getUrlHost());
logger.info("成员详情(代开)={}",JSON.toJSONString(user)) ;
if(null != user && null != user.getDepartment()) {
this.staffDepartChange(staff, wxEnterpriseId, user.getDepartment(),false); ;
......
......@@ -211,7 +211,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
if(qwDTO.isSelf()) {
log.info("自建={}",corpid,qwDTO.getSelfSecret());
result = this.qywxUserApiService.sendSelfWelcomeMsgByExternal(corpid, qwDTO.getSelfSecret(),
qywxWelcomeMsgDTO);
qywxWelcomeMsgDTO , qwDTO.getUrlHost());
}else {
result = this.qywxUserApiService.sendWelcomeMsgByExternal(corpid, config.getWxSuiteid(),
qywxWelcomeMsgDTO);
......@@ -392,7 +392,7 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
log.info("查询好友详情,externalUserId={},{}", externalUserId,qwDTO.getWxSecurityType());
String userInfo = null ;
if(qwDTO.isSelf()) {
userInfo =qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId);
userInfo =qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId,qwDTO.getUrlHost());
}else {
userInfo =qywxUserApiService.getExternalUseridInfo(qwDTO.getThirdCorpid(), config.getWxSuiteid(), externalUserId);
}
......
......@@ -842,7 +842,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
ExternalUserDTO externalUserDTO;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
if(qwDTO.isSelf()) {
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), dto.getExternalUserid());
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), dto.getExternalUserid(),qwDTO.getUrlHost());
if (StringUtils.isBlank(unionIdJson)) {
log.info("好友不存在");
return null;
......@@ -1159,7 +1159,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log.info("没有配置客户联系secret:{}", wxEnterpriseId);
return list;
}
String res = qywxUserApiService.listSelfExternalUserid(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId);
String res = qywxUserApiService.listSelfExternalUserid(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId,qwDTO.getUrlHost());
log.info("【查询自建应用】res={}", res);
if (res != null && res.equals("1")) {
log.info("代表需要重试");
......@@ -1231,7 +1231,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log.info("没有配置secret");
return null;
}
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), externalUserId);
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), externalUserId,qwDTO.getUrlHost());
if (StringUtils.isBlank(unionIdJson)) {
log.info("好友不存在");
return null;
......@@ -1256,7 +1256,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log.info("没有配置secret");
return null;
}
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getMemberCorpid(), secretSetting.getSecretVal(), externalUserId);
String unionIdJson = qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getMemberCorpid(), secretSetting.getSecretVal(), externalUserId,qwDTO.getUrlHost());
if (StringUtils.isBlank(unionIdJson)) {
log.info("好友不存在");
return null;
......@@ -1284,7 +1284,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
String wxOpenUseId = tabHaobanStaff.getWxOpenUseId();
String uJ = null ;
if(qwDTO.isSelf()) {
uJ = this.qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId) ;
uJ = this.qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId,qwDTO.getUrlHost()) ;
}else {
uJ = this.qywxUserApiService.getExternalUseridInfo(qwDTO.getThirdCorpid(), config.getWxSuiteid(), externalUserId);
}
......@@ -1639,7 +1639,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
String uJ = null ;
if(qwDTO.isSelf()) {
uJ = this.qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId) ;
uJ = this.qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId,qwDTO.getUrlHost()) ;
}else {
uJ = this.qywxUserApiService.getExternalUseridInfo(qwDTO.getThirdCorpid(), config.getWxSuiteid(), externalUserId);
}
......
......@@ -336,8 +336,8 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("没有配置secret,wxEnterpriseId:{}", wxEnterpriseId);
return;
}
UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpId, secretSetting.getSecretVal(), userid);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpId, secretSetting.getSecretVal(), userid ,qwDTO.getUrlHost());
if (null != user) {
Integer status = user.getStatus();
// 1=已激活,2=已禁用,4=未激活,5=退出企业。
......
......@@ -462,7 +462,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
String wxSuiteid = config.getWxSuiteid();
String externalUseridInfo = null ;
if(qwDTO.isSelf()) {
externalUseridInfo = this.qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId) ;
externalUseridInfo = this.qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId,qwDTO.getUrlHost()) ;
}else {
externalUseridInfo = this.qywxUserApiService.getExternalUseridInfo(qwDTO.getThirdCorpid(), wxSuiteid, externalUserId);
}
......@@ -587,7 +587,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
//查询外部联系人
String externalUseridInfo = null ;
if(qwDTO.isSelf()) {
externalUseridInfo = this.qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId) ;
externalUseridInfo = this.qywxUserApiService.getCorpSelfExternalUseridInfo(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), externalUserId,qwDTO.getUrlHost()) ;
}else {
externalUseridInfo = this.qywxUserApiService.getExternalUseridInfo(qwDTO.getThirdCorpid(), config.getWxSuiteid(), externalUserId);
}
......@@ -962,7 +962,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());
QywxResponseDTO responseDTO = qywxUserApiService.markTag(corpid, QwUtils.getSecret(qwDTO, config.getWxSuiteid()), wxUserId, externalUserId, needSetTagList, needDelTagList , qwDTO.isSelf() ,qwDTO.getUrlHost());
logger.info("操作返回:{}", JSONObject.toJSONString(responseDTO));
if (responseDTO.getErrcode() != 0) {
logger.info("权限不对,重试三次:{},{}", wxUserId, externalUserId);
......
......@@ -196,14 +196,14 @@ public class StaffApiServiceImpl implements StaffApiService {
if (qwDTO.getWxSecurityType() == 4) {
user = qywxUserApiService.getWorkWxUser(qwDTO.getThirdCorpid(), config.getWxSuiteid(), wxUserId);
logger.info("成员详情(第三方)={}", JSON.toJSONString(user));
UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), user.getOpen_userid());
UserDTO userSelf = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), user.getOpen_userid() , qwDTO.getUrlHost());
logger.info("成员详情(代开)={}", JSON.toJSONString(user));
if (user != null && userSelf != null) {
user.setName(userSelf.getName());
user.setPosition(userSelf.getPosition());
}
} else {
user = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), wxUserId);
user = qywxUserApiService.getSelfWorkWxUser(dkCorpid, secretSetting.getSecretVal(), wxUserId , qwDTO.getUrlHost());
logger.info("成员详情(代开)={}", JSON.toJSONString(user));
}
if (null == user) {
......@@ -489,7 +489,8 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public void initWxUser(String corpid, String contactSecret, String wxEnterpriseId, Integer wxDepartmentId, String taskId) {
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(corpid, contactSecret, wxDepartmentId.toString(), 0);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(corpid, contactSecret, wxDepartmentId.toString(), 0 , qwDTO.getUrlHost());
if (CollectionUtils.isNotEmpty(list)) {
for (UserDTO dto : list) {
try {
......
......@@ -49,27 +49,11 @@ public class TestServiceImpl implements TestApiService {
@Override
public String listSelfQywxUser(String corpid, String secretVal, String dataId) {
long t = System.currentTimeMillis();
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(corpid, secretVal, dataId, 0);
logger.info("耗时为===============>{}毫秒", (System.currentTimeMillis() - t));
if (null != list) {
logger.info("微信获取部门成员数量为:{}", list.size());
} else {
logger.info("微信获取部门成员数量异常");
}
return "";
}
@Override
public String listAllQywxUser(String corpid, String secretVal, String dataId) {
long t = System.currentTimeMillis();
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(corpid, secretVal, dataId, 1);
logger.info("耗时为===============>{}毫秒", (System.currentTimeMillis() - t));
if (null != list) {
logger.info("微信获取部门成员数量为:{}", list.size());
} else {
logger.info("微信获取部门成员数量异常");
}
return "";
}
......
......@@ -170,12 +170,12 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
if ("0".equals(pDataId)) {
//根级部门
List<UserDTO> list = null ;
WxEnterpriseQwDTO wxInfo = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
if(wxInfo.getWxSecurityType()==4) {
list = this.qywxUserApiService.listDepartmentUser(wxInfo.getThirdCorpid(), config.getWxSuiteid(), dataId, 1) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
if(qwDTO.getWxSecurityType()==4) {
list = this.qywxUserApiService.listDepartmentUser(qwDTO.getThirdCorpid(), config.getWxSuiteid(), dataId, 1) ;
logger.info("从(第三方)获取通讯录={}",JSON.toJSONString(list)) ;
}else {
list = this.qywxUserApiService.listSelfDepartmentUser(wxInfo.getDkCorpid(), secretSetting.getSecretVal(), dataId, 1);
list = this.qywxUserApiService.listSelfDepartmentUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), dataId, 1,qwDTO.getUrlHost());
logger.info("从(代开)获取通讯录={}",JSON.toJSONString(list)) ;
}
if (null == list) {
......
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