Commit 85e96745 by qwmqiuwenmin

fix

parent d1b2afc2
......@@ -56,4 +56,6 @@ public interface MemberUnionidRelatedApiService {
String addExternal(ExternalUserDTO dto);
ExternalUserDTO getExternalUseridInfo(String wxEnterpriseId, String wxUserId, String externalUserId);
}
......@@ -13,6 +13,8 @@ public class ExternalUserPojo implements Serializable{
private String avatar;
private String addCreateTime;
private String externalUserId;
public String getWxEnterpriseId() {
return wxEnterpriseId;
......@@ -53,6 +55,14 @@ public class ExternalUserPojo implements Serializable{
public void setAddCreateTime(String addCreateTime) {
this.addCreateTime = addCreateTime;
}
public String getExternalUserId() {
return externalUserId;
}
public void setExternalUserId(String externalUserId) {
this.externalUserId = externalUserId;
}
......
......@@ -833,6 +833,57 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
ExternalUserPojo pojo = getExternalUserPojo(unionIdJson, wxUserId, wxEnterpriseId);
return EntityUtil.changeEntityByJSON(ExternalUserDTO.class, pojo);
}
@Override
public ExternalUserDTO getExternalUseridInfo(String wxEnterpriseId,String wxUserId, String externalUserId) {
WxEnterpriseDTO wxEnterprise = wxEnterpriseService.selectById(wxEnterpriseId);
if(wxEnterprise == null){
log.info("企业不存在");
return null;
}
String uJ = qywxUserApiService.getExternalUseridInfo(wxEnterprise.getCorpid(), config.getWxSuiteid(), externalUserId);
if(StringUtils.isBlank(uJ)){
log.info("好友不存在");
return null;
}
String name = "";
String createTime = "";
String avatar = "";
if(StringUtils.isNotBlank(uJ)){
JSONObject jo = JSON.parseObject(uJ);
String external_contact = jo.getString("external_contact");
String uj_follow_user = jo.getString("follow_user");
JSONObject jt = null;
if(StringUtils.isNotBlank(external_contact)){
jt = JSON.parseObject(external_contact);
name = EmojiFilterUtil.filterEmojiLast(jt.getString("name"), true);
avatar = jt.getString("avatar");
}
if(StringUtils.isNotBlank(uj_follow_user)){
JSONArray j = JSON.parseArray(uj_follow_user);
String uj_userId = "";
for (Object object : j) {
String followJson = JSON.toJSONString(object);
JSONObject follow = JSON.parseObject(followJson);
uj_userId = follow.getString("userid");
if(uj_userId.equals(wxUserId)){
if(jt != null){
externalUserId = jt.getString("external_userid");
createTime = jt.getString("createtime");
break;
}
}
}
}
}
ExternalUserPojo pojo = new ExternalUserPojo();
pojo.setExternalUserId(externalUserId);
pojo.setName(name);
pojo.setAddCreateTime(createTime);
pojo.setWxEnterpriseId(wxEnterpriseId);
pojo.setAvatar(avatar);
return EntityUtil.changeEntityByJSON(ExternalUserDTO.class, pojo);
}
@Override
public String addExternal(ExternalUserDTO dto) {
String wxUserId = dto.getWxUserId();
......
......@@ -77,7 +77,7 @@ public class FriendSyncOperation implements BaseSyncOperation {
checkStaffTask(taskId, wxUserId);
return;
}
ExternalUserDTO pojo = memberUnionidRelatedApiService.getCorpSelfExternalUseridInfo(wxEnterpriseId,wxUserId, externalUserId);
ExternalUserDTO pojo = memberUnionidRelatedApiService.getExternalUseridInfo(wxEnterpriseId, wxUserId, externalUserId);
if(pojo == null){
preDealService.updateStatusByDataId(taskId, externalUserId, PreDealStatusEnum.exception.getVal(), "好友不存在");
checkStaffTask(taskId, wxUserId);
......
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