|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
@@ -477,10 +478,11 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public OpenImResponseDTO deleteUserInfo(String ownerUserID,String friendUserID) {
|
|
|
+ public R deleteUserInfo(String ownerUserID,String friendUserID) {
|
|
|
OpenImResponseDTO responseDTO = null;
|
|
|
String adminToken = getAdminToken();
|
|
|
//删除好友
|
|
|
+
|
|
|
Map<String, Object> bodyMap = new HashMap<>();
|
|
|
bodyMap.put("ownerUserID", ownerUserID);
|
|
|
bodyMap.put("friendUserID", friendUserID);
|
|
|
@@ -492,6 +494,18 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
.execute()
|
|
|
.body();
|
|
|
|
|
|
+ // 反过来再删除一次,确保双向好友关系都解除
|
|
|
+ Map<String, Object> bodyMap2 = new HashMap<>();
|
|
|
+ bodyMap2.put("ownerUserID", friendUserID);
|
|
|
+ bodyMap2.put("friendUserID", ownerUserID);
|
|
|
+ String jsonBody2 = JSONUtil.toJsonStr(bodyMap2);
|
|
|
+ String result2 = HttpRequest.post(IMConfig.URL+"/friend/delete_friend")
|
|
|
+ .header("operationID", String.valueOf(System.currentTimeMillis()))
|
|
|
+ .header("token", adminToken)
|
|
|
+ .body(jsonBody2)
|
|
|
+ .execute()
|
|
|
+ .body();
|
|
|
+
|
|
|
/* //增加黑名单
|
|
|
Map<String, Object> bodyMap1 = new HashMap<>();
|
|
|
bodyMap1.put("ownerUserID", ownerUserID);
|
|
|
@@ -504,7 +518,36 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
.execute()
|
|
|
.body();*/
|
|
|
responseDTO= JSONUtil.toBean(result1,OpenImResponseDTO.class);
|
|
|
- return responseDTO;
|
|
|
+ if(responseDTO.getErrCode()==0){
|
|
|
+ // 如果 有销售关系 需要解除看课记录关系
|
|
|
+ if((ownerUserID.startsWith("U") && friendUserID.startsWith("C")) ||
|
|
|
+ (ownerUserID.startsWith("C") && friendUserID.startsWith("U")) ){
|
|
|
+ Long companyUserId;
|
|
|
+ Long userId;
|
|
|
+ String remark;
|
|
|
+ if(ownerUserID.startsWith("C")){
|
|
|
+ companyUserId=Long.parseLong(ownerUserID.replace("C",""));
|
|
|
+ userId=Long.parseLong(friendUserID.replace("U",""));
|
|
|
+ remark="销售解除用户好友关系";
|
|
|
+ }else {
|
|
|
+ companyUserId=Long.parseLong(friendUserID.replace("C",""));
|
|
|
+ userId=Long.parseLong(ownerUserID.replace("U",""));
|
|
|
+ remark="用户解除销售好友关系";
|
|
|
+ }
|
|
|
+
|
|
|
+ FsUserCompanyUser update=new FsUserCompanyUser();
|
|
|
+ update.setStatus(2);
|
|
|
+ update.setUserId(userId);
|
|
|
+ update.setCompanyUserId(companyUserId);
|
|
|
+ update.setRemark(remark);
|
|
|
+ fsUserCompanyUserMapper.updateFriendStatus(update);
|
|
|
+
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ log.error("删除好友失败:{}",responseDTO.getErrMsg());
|
|
|
+ return R.error(responseDTO.getErrMsg());
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
}
|
|
|
|
|
|
@Data
|
|
|
@@ -1916,4 +1959,23 @@ public class OpenIMServiceImpl implements OpenIMService {
|
|
|
log.error("异步发送系统消息失败:userId={}, error={}", userId, e.getMessage(), e);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public OpenImResponseDTO getUserInfo(String id) {
|
|
|
+ // 是数字的话默认用户
|
|
|
+ if(id.matches("\\d+")){
|
|
|
+ id = "U"+id;
|
|
|
+ }
|
|
|
+ String adminToken = getAdminToken();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("userIDs", Collections.singletonList(id));
|
|
|
+ String body = HttpRequest.post(IMConfig.URL+"/user/get_users_info")
|
|
|
+ .header("operationID", String.valueOf(System.currentTimeMillis()))
|
|
|
+ .header("token", adminToken)
|
|
|
+ .body(jsonObject.toString())
|
|
|
+ .execute()
|
|
|
+ .body();
|
|
|
+ OpenImResponseDTO responseDTO= JSONUtil.toBean(body,OpenImResponseDTO.class);
|
|
|
+ return responseDTO;
|
|
|
+ }
|
|
|
}
|