|
@@ -38,7 +38,7 @@ import static sun.plugin2.os.windows.OSVERSIONINFOA.size;
|
|
|
@Service("ConversationContentService")
|
|
@Service("ConversationContentService")
|
|
|
public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMapper> implements ConversationContentService {
|
|
public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMapper> implements ConversationContentService {
|
|
|
|
|
|
|
|
- static String priKey ="-----BEGIN PRIVATE KEY-----\n" +
|
|
|
|
|
|
|
+ static String hnPriKey ="-----BEGIN PRIVATE KEY-----\n" +
|
|
|
"MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCnh5N/kiyeNx/y\n" +
|
|
"MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCnh5N/kiyeNx/y\n" +
|
|
|
"dDKe3FO8HWj8tuQQUCkCc8ol1Sqmcs9ey7S2189UDbZOPeY2xiiMD6AdFVUK5Y0P\n" +
|
|
"dDKe3FO8HWj8tuQQUCkCc8ol1Sqmcs9ey7S2189UDbZOPeY2xiiMD6AdFVUK5Y0P\n" +
|
|
|
"gbX/XZFVizhwXseE+1IV1k0w3C++5Y4Zll7nZoJ05ANMbj+dlamAlNYOutmc0lZf\n" +
|
|
"gbX/XZFVizhwXseE+1IV1k0w3C++5Y4Zll7nZoJ05ANMbj+dlamAlNYOutmc0lZf\n" +
|
|
@@ -81,14 +81,20 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value(value = "${conversationContent.corpid}")
|
|
@Value(value = "${conversationContent.corpid}")
|
|
|
- private String corpid;
|
|
|
|
|
|
|
+ private String hnCorpId;
|
|
|
@Value(value = "${conversationContent.secret}")
|
|
@Value(value = "${conversationContent.secret}")
|
|
|
- private String secret;
|
|
|
|
|
|
|
+ private String hnSecret;
|
|
|
|
|
|
|
|
@Value(value = "${conversationContent.app.secret}")
|
|
@Value(value = "${conversationContent.app.secret}")
|
|
|
- private String appSecret;
|
|
|
|
|
- @Value(value = "${conversationContent.addressBook.secret}")
|
|
|
|
|
- private String addressBookSecret;
|
|
|
|
|
|
|
+ private String hnAppSecret;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${conversationContent.nm.corpid}")
|
|
|
|
|
+ private String nmCorpid;
|
|
|
|
|
+ @Value(value = "${conversationContent.nm.secret}")
|
|
|
|
|
+ private String nmSecret;
|
|
|
|
|
+
|
|
|
|
|
+ @Value(value = "${conversationContent.nm.app.secret}")
|
|
|
|
|
+ private String nmAppSecret;
|
|
|
@Value(value = "${upload.path}")
|
|
@Value(value = "${upload.path}")
|
|
|
private String uploadPath;
|
|
private String uploadPath;
|
|
|
|
|
|
|
@@ -110,13 +116,26 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public Map<String,Object> pushChatData(Integer pageSeq, Integer pageLimit,Integer days) {
|
|
|
|
|
|
|
+ public Map<String,Object> pushChatData(Integer pageSeq, Integer pageLimit,Integer days,Integer type) {
|
|
|
String message = null;
|
|
String message = null;
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
List<InputChatMsg> list = new ArrayList<>();
|
|
List<InputChatMsg> list = new ArrayList<>();
|
|
|
Integer total = 0;
|
|
Integer total = 0;
|
|
|
long sdk = Finance.NewSdk();
|
|
long sdk = Finance.NewSdk();
|
|
|
- System.out.println(Finance.Init(sdk, corpid, secret));
|
|
|
|
|
|
|
+ String corpId =null;
|
|
|
|
|
+ String secret =null;
|
|
|
|
|
+ String priKey =null;
|
|
|
|
|
+ if (type==0){
|
|
|
|
|
+ corpId = hnCorpId;
|
|
|
|
|
+ secret = hnSecret;
|
|
|
|
|
+ priKey = hnPriKey;
|
|
|
|
|
+ }else if (type==1){
|
|
|
|
|
+ corpId = nmCorpid;
|
|
|
|
|
+ secret = nmSecret;
|
|
|
|
|
+ priKey = nmAppSecret;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ System.out.println(Finance.Init(sdk, corpId, secret));
|
|
|
long ret = 0;
|
|
long ret = 0;
|
|
|
int seq = 0;
|
|
int seq = 0;
|
|
|
int limit = 200;
|
|
int limit = 200;
|
|
@@ -167,7 +186,7 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
System.out.println("getwep="+str);
|
|
System.out.println("getwep="+str);
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(str);
|
|
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(str);
|
|
|
String msgtype = jsonObject.getString("msgtype");
|
|
String msgtype = jsonObject.getString("msgtype");
|
|
|
- InputChatMsg chatMsg = new InputChatMsg(jsonObject);
|
|
|
|
|
|
|
+ InputChatMsg chatMsg = new InputChatMsg(jsonObject,type);
|
|
|
System.out.println(chatMsg.getMsgtime());
|
|
System.out.println(chatMsg.getMsgtime());
|
|
|
if (chatMsg.getMsgtime().getTime()>date.getTime()){
|
|
if (chatMsg.getMsgtime().getTime()>date.getTime()){
|
|
|
//处理数据
|
|
//处理数据
|
|
@@ -370,86 +389,155 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public String getAccessToken() {
|
|
|
|
|
- //获取redis缓存数据
|
|
|
|
|
|
|
+ public String getAccessToken(Integer type) {
|
|
|
|
|
+ String corpId =null;
|
|
|
|
|
+ String secret =null;
|
|
|
String accessToken = null;
|
|
String accessToken = null;
|
|
|
- Map<String,String> accessMap = (Map<String, String>) redisTemplate.opsForValue().get("ACCESS_TOKEN");
|
|
|
|
|
- if (accessMap == null){
|
|
|
|
|
- logger.debug("getAccessToken无缓存从接口获取");
|
|
|
|
|
- Map<String, String> map = getAccessMap(corpid, secret);
|
|
|
|
|
- //新增redis缓存数据
|
|
|
|
|
- redisTemplate.opsForValue().set("ACCESS_TOKEN",map);
|
|
|
|
|
- accessToken = map.get("accessToken");
|
|
|
|
|
- }else {
|
|
|
|
|
- logger.debug("getAccessToken有缓存从缓存获取");
|
|
|
|
|
- accessToken = accessMap.get("accessToken");
|
|
|
|
|
- Long expireDate = Long.valueOf(accessMap.get("expireDate"));
|
|
|
|
|
- if (expireDate < System.currentTimeMillis()){
|
|
|
|
|
- logger.debug("getAccessToken缓存已过期从接口获取");
|
|
|
|
|
- Map<String, String> map = getAccessMap(corpid, secret);
|
|
|
|
|
- accessToken = map.get("accessToken");
|
|
|
|
|
|
|
+ if (type==0){
|
|
|
|
|
+ corpId = hnCorpId;
|
|
|
|
|
+ secret = hnSecret;
|
|
|
|
|
+ //获取redis缓存数据
|
|
|
|
|
+
|
|
|
|
|
+ Map<String,String> accessMap = (Map<String, String>) redisTemplate.opsForValue().get("ACCESS_TOKEN");
|
|
|
|
|
+ if (accessMap == null){
|
|
|
|
|
+ logger.debug("getAccessToken无缓存从接口获取");
|
|
|
|
|
+ Map<String, String> map = getAccessMap(corpId, secret);
|
|
|
//新增redis缓存数据
|
|
//新增redis缓存数据
|
|
|
redisTemplate.opsForValue().set("ACCESS_TOKEN",map);
|
|
redisTemplate.opsForValue().set("ACCESS_TOKEN",map);
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return accessToken;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- public String getAddressBookAccessToken() {
|
|
|
|
|
- //获取redis缓存数据
|
|
|
|
|
- String accessToken = null;
|
|
|
|
|
- Map<String,String> accessMap = (Map<String, String>) redisTemplate.opsForValue().get("ADDRESS_BOOK_ACCESS_TOKEN");
|
|
|
|
|
- if (accessMap == null){
|
|
|
|
|
- logger.debug("ADDRESS_BOOK无缓存从接口获取");
|
|
|
|
|
- Map<String, String> map = getAccessMap(corpid, secret);
|
|
|
|
|
- //新增redis缓存数据
|
|
|
|
|
- redisTemplate.opsForValue().set("ADDRESS_BOOK_ACCESS_TOKEN",map);
|
|
|
|
|
- accessToken = map.get("accessToken");
|
|
|
|
|
- }else {
|
|
|
|
|
- logger.debug("ADDRESS_BOOK有缓存从缓存获取");
|
|
|
|
|
- accessToken = accessMap.get("accessToken");
|
|
|
|
|
- Long expireDate = Long.valueOf(accessMap.get("expireDate"));
|
|
|
|
|
- if (expireDate < System.currentTimeMillis()){
|
|
|
|
|
- logger.debug("ADDRESS_BOOK缓存已过期从接口获取");
|
|
|
|
|
- Map<String, String> map = getAccessMap(corpid, secret);
|
|
|
|
|
accessToken = map.get("accessToken");
|
|
accessToken = map.get("accessToken");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ logger.debug("getAccessToken有缓存从缓存获取");
|
|
|
|
|
+ accessToken = accessMap.get("accessToken");
|
|
|
|
|
+ Long expireDate = Long.valueOf(accessMap.get("expireDate"));
|
|
|
|
|
+ if (expireDate < System.currentTimeMillis()){
|
|
|
|
|
+ logger.debug("getAccessToken缓存已过期从接口获取");
|
|
|
|
|
+ Map<String, String> map = getAccessMap(corpId, secret);
|
|
|
|
|
+ accessToken = map.get("accessToken");
|
|
|
|
|
+ //新增redis缓存数据
|
|
|
|
|
+ redisTemplate.opsForValue().set("ACCESS_TOKEN",map);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if (type==1){
|
|
|
|
|
+ corpId = nmCorpid;
|
|
|
|
|
+ secret = nmSecret;
|
|
|
|
|
+ //获取redis缓存数据
|
|
|
|
|
+ Map<String,String> accessMap = (Map<String, String>) redisTemplate.opsForValue().get("NM_ACCESS_TOKEN");
|
|
|
|
|
+ if (accessMap == null){
|
|
|
|
|
+ logger.debug("getAccessToken无缓存从接口获取");
|
|
|
|
|
+ Map<String, String> map = getAccessMap(corpId, secret);
|
|
|
//新增redis缓存数据
|
|
//新增redis缓存数据
|
|
|
- redisTemplate.opsForValue().set("ADDRESS_BOOK_ACCESS_TOKEN",map);
|
|
|
|
|
|
|
+ redisTemplate.opsForValue().set("NM_ACCESS_TOKEN",map);
|
|
|
|
|
+ accessToken = map.get("accessToken");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ logger.debug("getAccessToken有缓存从缓存获取");
|
|
|
|
|
+ accessToken = accessMap.get("accessToken");
|
|
|
|
|
+ Long expireDate = Long.valueOf(accessMap.get("expireDate"));
|
|
|
|
|
+ if (expireDate < System.currentTimeMillis()){
|
|
|
|
|
+ logger.debug("getAccessToken缓存已过期从接口获取");
|
|
|
|
|
+ Map<String, String> map = getAccessMap(corpId, secret);
|
|
|
|
|
+ accessToken = map.get("accessToken");
|
|
|
|
|
+ //新增redis缓存数据
|
|
|
|
|
+ redisTemplate.opsForValue().set("NM_ACCESS_TOKEN",map);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return accessToken;
|
|
return accessToken;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+// public String getAddressBookAccessToken(Integer type) {
|
|
|
|
|
+// String corpId =null;
|
|
|
|
|
+// String secret =null;
|
|
|
|
|
+// if (type==0){
|
|
|
|
|
+// corpId = hnCorpId;
|
|
|
|
|
+// secret = hnSecret;
|
|
|
|
|
+// }else if (type==1){
|
|
|
|
|
+// corpId = nmCorpid;
|
|
|
|
|
+// secret = nmSecret;
|
|
|
|
|
+// }
|
|
|
|
|
+// //获取redis缓存数据
|
|
|
|
|
+// String accessToken = null;
|
|
|
|
|
+// Map<String,String> accessMap = (Map<String, String>) redisTemplate.opsForValue().get("ADDRESS_BOOK_ACCESS_TOKEN");
|
|
|
|
|
+// if (accessMap == null){
|
|
|
|
|
+// logger.debug("ADDRESS_BOOK无缓存从接口获取");
|
|
|
|
|
+// Map<String, String> map = getAccessMap(corpId, secret);
|
|
|
|
|
+// //新增redis缓存数据
|
|
|
|
|
+// redisTemplate.opsForValue().set("ADDRESS_BOOK_ACCESS_TOKEN",map);
|
|
|
|
|
+// accessToken = map.get("accessToken");
|
|
|
|
|
+// }else {
|
|
|
|
|
+// logger.debug("ADDRESS_BOOK有缓存从缓存获取");
|
|
|
|
|
+// accessToken = accessMap.get("accessToken");
|
|
|
|
|
+// Long expireDate = Long.valueOf(accessMap.get("expireDate"));
|
|
|
|
|
+// if (expireDate < System.currentTimeMillis()){
|
|
|
|
|
+// logger.debug("ADDRESS_BOOK缓存已过期从接口获取");
|
|
|
|
|
+// Map<String, String> map = getAccessMap(corpId, secret);
|
|
|
|
|
+// accessToken = map.get("accessToken");
|
|
|
|
|
+// //新增redis缓存数据
|
|
|
|
|
+// redisTemplate.opsForValue().set("ADDRESS_BOOK_ACCESS_TOKEN",map);
|
|
|
|
|
+// }
|
|
|
|
|
+// }
|
|
|
|
|
+// return accessToken;
|
|
|
|
|
+// }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
- public String getAppAccessToken() {
|
|
|
|
|
- //获取redis缓存数据
|
|
|
|
|
- String accessToken = null;
|
|
|
|
|
- Map<String,String> accessMap = (Map<String, String>) redisTemplate.opsForValue().get("ADDRESS_BOOK_ACCESS_TOKEN");
|
|
|
|
|
- if (accessMap == null){
|
|
|
|
|
- logger.debug("APP_ACCESS_TOKEN无缓存从接口获取");
|
|
|
|
|
- Map<String, String> map = getAccessMap(corpid,appSecret);
|
|
|
|
|
- //新增redis缓存数据
|
|
|
|
|
- redisTemplate.opsForValue().set("APP_ACCESS_TOKEN",map);
|
|
|
|
|
- accessToken = map.get("accessToken");
|
|
|
|
|
- }else {
|
|
|
|
|
- logger.debug("APP_ACCESS_TOKEN有缓存从缓存获取");
|
|
|
|
|
- accessToken = accessMap.get("accessToken");
|
|
|
|
|
- Long expireDate = Long.valueOf(accessMap.get("expireDate"));
|
|
|
|
|
- if (expireDate < System.currentTimeMillis()){
|
|
|
|
|
- logger.debug("APP_ACCESS_TOKEN缓存已过期从接口获取");
|
|
|
|
|
- Map<String, String> map = getAccessMap(corpid,appSecret);
|
|
|
|
|
- accessToken = map.get("accessToken");
|
|
|
|
|
|
|
+ public String getAppAccessToken(Integer type) {
|
|
|
|
|
+ String corpId =null;
|
|
|
|
|
+ String appSecret =null;
|
|
|
|
|
+ String accessToken=null;
|
|
|
|
|
+ if (type==0){
|
|
|
|
|
+ corpId = hnCorpId;
|
|
|
|
|
+ appSecret = hnAppSecret;
|
|
|
|
|
+ //获取redis缓存数据
|
|
|
|
|
+ Map<String,String> accessMap = (Map<String, String>) redisTemplate.opsForValue().get("ADDRESS_BOOK_ACCESS_TOKEN");
|
|
|
|
|
+ if (accessMap == null){
|
|
|
|
|
+ logger.debug("APP_ACCESS_TOKEN无缓存从接口获取");
|
|
|
|
|
+ Map<String, String> map = getAccessMap(corpId,appSecret);
|
|
|
//新增redis缓存数据
|
|
//新增redis缓存数据
|
|
|
redisTemplate.opsForValue().set("APP_ACCESS_TOKEN",map);
|
|
redisTemplate.opsForValue().set("APP_ACCESS_TOKEN",map);
|
|
|
|
|
+ accessToken = map.get("accessToken");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ logger.debug("APP_ACCESS_TOKEN有缓存从缓存获取");
|
|
|
|
|
+ accessToken = accessMap.get("accessToken");
|
|
|
|
|
+ Long expireDate = Long.valueOf(accessMap.get("expireDate"));
|
|
|
|
|
+ if (expireDate < System.currentTimeMillis()){
|
|
|
|
|
+ logger.debug("APP_ACCESS_TOKEN缓存已过期从接口获取");
|
|
|
|
|
+ Map<String, String> map = getAccessMap(corpId,appSecret);
|
|
|
|
|
+ accessToken = map.get("accessToken");
|
|
|
|
|
+ //新增redis缓存数据
|
|
|
|
|
+ redisTemplate.opsForValue().set("APP_ACCESS_TOKEN",map);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }else if (type==1){
|
|
|
|
|
+ corpId = nmCorpid;
|
|
|
|
|
+ appSecret = nmAppSecret;
|
|
|
|
|
+ //获取redis缓存数据
|
|
|
|
|
+ Map<String,String> accessMap = (Map<String, String>) redisTemplate.opsForValue().get("NM_ADDRESS_BOOK_ACCESS_TOKEN");
|
|
|
|
|
+ if (accessMap == null){
|
|
|
|
|
+ logger.debug("NM_APP_ACCESS_TOKEN无缓存从接口获取");
|
|
|
|
|
+ Map<String, String> map = getAccessMap(corpId,appSecret);
|
|
|
|
|
+ //新增redis缓存数据
|
|
|
|
|
+ redisTemplate.opsForValue().set("NM_APP_ACCESS_TOKEN",map);
|
|
|
|
|
+ accessToken = map.get("accessToken");
|
|
|
|
|
+ }else {
|
|
|
|
|
+ logger.debug("NM_APP_ACCESS_TOKEN有缓存从缓存获取");
|
|
|
|
|
+ accessToken = accessMap.get("accessToken");
|
|
|
|
|
+ Long expireDate = Long.valueOf(accessMap.get("expireDate"));
|
|
|
|
|
+ if (expireDate < System.currentTimeMillis()){
|
|
|
|
|
+ logger.debug("NM_APP_ACCESS_TOKEN缓存已过期从接口获取");
|
|
|
|
|
+ Map<String, String> map = getAccessMap(corpId,appSecret);
|
|
|
|
|
+ accessToken = map.get("accessToken");
|
|
|
|
|
+ //新增redis缓存数据
|
|
|
|
|
+ redisTemplate.opsForValue().set("NM_APP_ACCESS_TOKEN",map);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
return accessToken;
|
|
return accessToken;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public String getPermitUserList() {
|
|
|
|
|
- String url=String.format("https://qyapi.weixin.qq.com/cgi-bin/msgaudit/get_permit_user_list?access_token=%s",getAccessToken());
|
|
|
|
|
|
|
+ public String getPermitUserList(Integer type) {
|
|
|
|
|
+ String url=String.format("https://qyapi.weixin.qq.com/cgi-bin/msgaudit/get_permit_user_list?access_token=%s",getAccessToken(type));
|
|
|
com.alibaba.fastjson.JSONObject result = HttpUtils.httpGet(url);
|
|
com.alibaba.fastjson.JSONObject result = HttpUtils.httpGet(url);
|
|
|
|
|
|
|
|
if (result.getInteger("errcode")==0){
|
|
if (result.getInteger("errcode")==0){
|
|
@@ -459,7 +547,7 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
System.out.println(result.getString("errcode"));
|
|
System.out.println(result.getString("errcode"));
|
|
|
System.out.println("获取会话内容存档成员列表失败");
|
|
System.out.println("获取会话内容存档成员列表失败");
|
|
|
}
|
|
}
|
|
|
- pushGetChatName(result.toJSONString());
|
|
|
|
|
|
|
+ pushGetChatName(result.toJSONString(),type);
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -469,7 +557,7 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public Map<String,Object> pushGetChatName(String userId) {
|
|
|
|
|
|
|
+ public Map<String,Object> pushGetChatName(String userId, Integer type) {
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
Integer i = 0;
|
|
Integer i = 0;
|
|
|
ChatMsgUser chatMsgUser = chatMsgUserMapper.selectByUserId(userId);
|
|
ChatMsgUser chatMsgUser = chatMsgUserMapper.selectByUserId(userId);
|
|
@@ -480,19 +568,19 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
}else {
|
|
}else {
|
|
|
String msgIdSub = userId.substring(0, 2);
|
|
String msgIdSub = userId.substring(0, 2);
|
|
|
String url=null;
|
|
String url=null;
|
|
|
- Integer type;
|
|
|
|
|
|
|
+ Integer type2;
|
|
|
if (msgIdSub.equals("wb")){
|
|
if (msgIdSub.equals("wb")){
|
|
|
- type=0;
|
|
|
|
|
|
|
+ type2=0;
|
|
|
// url=String.format("https://qyapi.weixin.qq.com/cgi-bin/msgaudit/get_robot_info??access_token=%s&robot_id=%s",getAppAccessToken(),userId);
|
|
// 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")){
|
|
}else if (msgIdSub.equals("wo")||msgIdSub.equals("wm")){
|
|
|
// https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get
|
|
// 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(),userId);
|
|
|
|
|
- type=1;
|
|
|
|
|
|
|
+ url=String.format("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get?access_token=%s&external_userid=%s",getAppAccessToken(type),userId);
|
|
|
|
|
+ type2=1;
|
|
|
}else {
|
|
}else {
|
|
|
- url=String.format("https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token=%s&userid=%s",getAccessToken(),userId);
|
|
|
|
|
- type=2;
|
|
|
|
|
|
|
+ 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, type);
|
|
|
|
|
|
|
+ Map<String, Object> maps = getUserName(url, type2);
|
|
|
Object o = maps.get("name");
|
|
Object o = maps.get("name");
|
|
|
String userName = null;
|
|
String userName = null;
|
|
|
if(o!=null){
|
|
if(o!=null){
|
|
@@ -526,7 +614,7 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public String pushGetRoomName(ChatMsg chatMsg) {
|
|
|
|
|
|
|
+ public String pushGetRoomName(ChatMsg chatMsg, Integer type) {
|
|
|
String roomname=null;
|
|
String roomname=null;
|
|
|
// https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/get?access_token=ACCESS_TOKEN
|
|
// https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/get?access_token=ACCESS_TOKEN
|
|
|
String roomid = chatMsg.getRoomid();
|
|
String roomid = chatMsg.getRoomid();
|
|
@@ -539,7 +627,7 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
String msgIdSub = chatMsg.getMsgid();
|
|
String msgIdSub = chatMsg.getMsgid();
|
|
|
int i = msgIdSub.indexOf("external");
|
|
int i = msgIdSub.indexOf("external");
|
|
|
if (i>0){
|
|
if (i>0){
|
|
|
- String url=String.format("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/get?access_token=%s",getAppAccessToken());
|
|
|
|
|
|
|
+ String url=String.format("https://qyapi.weixin.qq.com/cgi-bin/externalcontact/groupchat/get?access_token=%s",getAppAccessToken(type));
|
|
|
Map<String,Object> map = new HashMap<String, Object>();
|
|
Map<String,Object> map = new HashMap<String, Object>();
|
|
|
map.put("chat_id",roomid);
|
|
map.put("chat_id",roomid);
|
|
|
map.put("cursor",0);
|
|
map.put("cursor",0);
|
|
@@ -559,7 +647,7 @@ public class ConversationContentServiceImpl extends BaseMybatisDao<ChatMsgUserMa
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
//https://qyapi.weixin.qq.com/cgi-bin/msgaudit/groupchat/get
|
|
//https://qyapi.weixin.qq.com/cgi-bin/msgaudit/groupchat/get
|
|
|
- String url=String.format("https://qyapi.weixin.qq.com/cgi-bin/msgaudit/groupchat/get?access_token=%s",getAccessToken());
|
|
|
|
|
|
|
+ String url=String.format("https://qyapi.weixin.qq.com/cgi-bin/msgaudit/groupchat/get?access_token=%s",getAccessToken(type));
|
|
|
Map<String,Object> map = new HashMap<String, Object>();
|
|
Map<String,Object> map = new HashMap<String, Object>();
|
|
|
map.put("roomid",roomid);
|
|
map.put("roomid",roomid);
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = HttpUtils.httpPost(url, map);
|
|
com.alibaba.fastjson.JSONObject jsonObject = HttpUtils.httpPost(url, map);
|