|
|
@@ -1058,6 +1058,25 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void checkAndImportFriendByDianBoNew(Long companyUserId, String fsUserId, boolean isUpdate) {
|
|
|
+ try {
|
|
|
+ // 注册账号
|
|
|
+ accountCheck("C" + companyUserId, "2");
|
|
|
+ accountCheck("U"+fsUserId, "1");
|
|
|
+
|
|
|
+ // 导入好友关系
|
|
|
+ ArrayList<String> userIds = new ArrayList<>();
|
|
|
+ userIds.add("U" + fsUserId);
|
|
|
+ importFriend("C" + companyUserId, userIds);
|
|
|
+ if(isUpdate){
|
|
|
+ updateFriendByDianBoNew("C" + companyUserId, userIds);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("异步执行IM注册/添加好友失败:", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional
|
|
|
@@ -1514,6 +1533,37 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
OpenImResponseDTO responseDTO= JSONUtil.toBean(body,OpenImResponseDTO.class);
|
|
|
return responseDTO;
|
|
|
}
|
|
|
+
|
|
|
+ public OpenImResponseDTO updateFriendByDianBoNew(String ownerUserID, List<String> friendUserIDs) {
|
|
|
+ //先检查用户是否存在好友关系
|
|
|
+ //List<String> newFriendIds = new ArrayList<>();
|
|
|
+ for (String friendUserID : friendUserIDs) {
|
|
|
+ OpenImResponseDTO friend = isFriend(ownerUserID,friendUserID);
|
|
|
+ if (friend.getErrCode()==0){
|
|
|
+ Object data = friend.getData();
|
|
|
+ cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(data);
|
|
|
+ Boolean inUser1Friends = (Boolean)jsonObject.get("inUser1Friends");
|
|
|
+ Boolean inUser2Friends = (Boolean)jsonObject.get("inUser2Friends");
|
|
|
+ //如果不存在好友关系,则不执行im修改好友信息
|
|
|
+ if (!inUser1Friends&&!inUser2Friends){
|
|
|
+ return null;
|
|
|
+ //friendUserIDs.remove(friendUserID);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String adminToken = getAdminToken();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("ownerUserID",ownerUserID);
|
|
|
+ jsonObject.put("friendUserIDs",friendUserIDs);
|
|
|
+ String body = HttpRequest.post(IMConfig.URL+"/friend/update_friends")
|
|
|
+ .header("operationID", String.valueOf(System.currentTimeMillis()))
|
|
|
+ .header("token", adminToken)
|
|
|
+ .body(jsonObject.toString())
|
|
|
+ .execute()
|
|
|
+ .body();
|
|
|
+ OpenImResponseDTO responseDTO= JSONUtil.toBean(body,OpenImResponseDTO.class);
|
|
|
+ return responseDTO;
|
|
|
+ }
|
|
|
@Override
|
|
|
public OpenImResponseDTO sendInquiryUtil(String sendID, String recvID, Integer contentType, String payloadData, String inquiryName, String type,Long companyId,Long companyUserId,String doctorId) {
|
|
|
try {
|