|
@@ -9,6 +9,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
|
+import com.fs.common.exception.ServiceException;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.company.domain.Company;
|
|
|
import com.fs.company.domain.CompanyUser;
|
|
@@ -910,7 +911,9 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
s = userId.replaceFirst("^"+openImPrefix+"C", "");
|
|
|
CompanyUser companyUser = companyUserMapper.selectCompanyUserByCompanyUserId(Long.parseLong(s));
|
|
|
if (null==companyUser){
|
|
|
- return R.error("用户不存在");
|
|
|
+// return R.error("用户不存在");
|
|
|
+ log.error("异步执行IM注册/添加好友失败,失败原因:{},userId:{},type:{}", "销售用户不存在",userId, type);
|
|
|
+ throw new ServiceException("用户不存在");
|
|
|
}
|
|
|
Company company = companyMapper.selectCompanyById(companyUser.getCompanyId());
|
|
|
map.put("userID",userId);
|
|
@@ -922,7 +925,9 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
s = userId.replaceFirst("^"+openImPrefix+"U", "");
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(Long.parseLong(s));
|
|
|
if (null==fsUser){
|
|
|
- return R.error("用户不存在");
|
|
|
+// return R.error("用户不存在");
|
|
|
+ log.error("异步执行IM注册/添加好友失败,失败原因:{},userId:{},type:{}", "user用户不存在", userId, type);
|
|
|
+ throw new ServiceException("用户不存在");
|
|
|
}
|
|
|
map.put("userID",userId);
|
|
|
map.put("nickname",StringUtils.isEmpty(fsUser.getNickName())?"微信用户":fsUser.getNickName());
|
|
@@ -932,7 +937,9 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
s = userId.replaceFirst("^"+openImPrefix+"D", "");
|
|
|
FsDoctor fsDoctor = fsDoctorMapper.selectFsDoctorByDoctorId(Long.parseLong(s));
|
|
|
if (null==fsDoctor){
|
|
|
- return R.error("用户不存在");
|
|
|
+// return R.error("用户不存在");
|
|
|
+ log.error("异步执行IM注册/添加好友失败,失败原因:{},userId:{},type:{}", "医生用户不存在", userId, type);
|
|
|
+ throw new ServiceException("用户不存在");
|
|
|
}
|
|
|
map.put("userID",userId);
|
|
|
map.put("nickname",fsDoctor.getDoctorName());
|
|
@@ -949,7 +956,9 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
.header("token", adminToken).body(requestBody.toString()).execute().body();
|
|
|
}
|
|
|
} else {
|
|
|
- return R.error("返回结果为空");
|
|
|
+// return R.error("返回结果为空");
|
|
|
+ log.error("异步执行IM注册/添加好友失败,失败原因:{},json结果:{}", "返回结果为空", jsonObject);
|
|
|
+ throw new ServiceException("返回结果为空");
|
|
|
}
|
|
|
/* HashMap<String, String> tokenMap = new HashMap<>();
|
|
|
tokenMap.put("platformID","1");
|
|
@@ -968,26 +977,30 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
String userToken = userData.getString("token");
|
|
|
return R.ok().put("token", userToken);
|
|
|
}
|
|
|
- return R.error("注册失败");
|
|
|
+// return R.error("注册失败");
|
|
|
+ log.error("异步执行IM注册/添加好友失败,errCode:{}", errCode);
|
|
|
+ throw new ServiceException("注册失败");
|
|
|
} else {
|
|
|
- return R.error("获取管理员token失败");
|
|
|
+// return R.error("获取管理员token失败");
|
|
|
+ log.error("异步执行IM注册/添加好友失败,原因:{}, adminToken:{}", "获取管理员token失败", adminToken);
|
|
|
+ throw new ServiceException("获取管理员token失败");
|
|
|
}
|
|
|
}
|
|
|
- @Async
|
|
|
+// @Async
|
|
|
@Override
|
|
|
public void checkAndImportFriend(Long companyUserId,String fsUserId) {
|
|
|
- try {
|
|
|
+// try {
|
|
|
// 注册账号
|
|
|
- accountCheck(IMConfig.PREFIX+"C" + companyUserId, "2");
|
|
|
- accountCheck(IMConfig.PREFIX+"U"+fsUserId, "1");
|
|
|
+ accountCheck(IMConfig.PREFIX + "C" + companyUserId, "2");
|
|
|
+ accountCheck(IMConfig.PREFIX + "U" + fsUserId, "1");
|
|
|
|
|
|
// 导入好友关系
|
|
|
ArrayList<String> userIds = new ArrayList<>();
|
|
|
userIds.add(IMConfig.PREFIX+"U" + fsUserId);
|
|
|
importFriend(IMConfig.PREFIX+"C" + companyUserId, userIds);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("异步执行IM注册/添加好友失败:", e);
|
|
|
- }
|
|
|
+// } catch (Exception e) {
|
|
|
+// log.error("异步执行IM注册/添加好友失败:", e);
|
|
|
+// }
|
|
|
}
|
|
|
|
|
|
@Async
|