|
|
@@ -771,6 +771,44 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
return chatMsgs;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> pushGetUserName(String userId, int type) {
|
|
|
+ ChatMsgUser chatMsgUser =new ChatMsgUser();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ String msgIdSub = userId.substring(0, 2);
|
|
|
+ String url=null;
|
|
|
+ Integer type2;
|
|
|
+ if (msgIdSub.equals("wb")){
|
|
|
+ type2=0;
|
|
|
+// url=String.format("https://qyapi.weixin.qq.com/cgi-bin/msgaudit/get_robot_info??access_token=%s&robot_id=%s",getAppAccessToken(),userId);
|
|
|
+ }else if (msgIdSub.equals("wo")||msgIdSub.equals("wm")){
|
|
|
+ // https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get
|
|
|
+ url=String.format("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get?access_token=%s&external_userid=%s",getAppAccessToken(type),userId);
|
|
|
+ type2=1;
|
|
|
+ }else {
|
|
|
+ url=String.format("https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=%s&userid=%s",getAccessToken(type),userId);
|
|
|
+ type2=2;
|
|
|
+ }
|
|
|
+ Map<String, Object> maps = getUserName(url, type2);
|
|
|
+ Object o = maps.get("name");
|
|
|
+ String userName = null;
|
|
|
+ if(o!=null){
|
|
|
+ userName = o.toString();
|
|
|
+ }
|
|
|
+ map.put ("code", maps.get("code"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(userName)){
|
|
|
+ map.put("name",userName);
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(userName)){
|
|
|
+ String str = "未知(" + chatMsgUser.getId() + ")";
|
|
|
+ chatMsgUser.setName(str);
|
|
|
+ map.put("name",str);
|
|
|
+ }
|
|
|
+ return map;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private Map<String,Object> getUserName(String url,Integer type){
|
|
|
String name = null;
|