Commit a22a34f4 by 徐高华

自建

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