123
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.ruoyi.test.business;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.yunxin.client.ImUserRefClient;
|
||||
import com.ruoyi.yunxin.req.GetUnifoReq;
|
||||
import com.ruoyi.yunxin.resp.YxUpdateUinfoR;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
@Slf4j
|
||||
public class YxTest {
|
||||
|
||||
@Autowired
|
||||
private ImUserRefClient imUserRefClient;
|
||||
|
||||
@Test
|
||||
public void test(){
|
||||
GetUnifoReq req = new GetUnifoReq();
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("1087");
|
||||
req.setAccids(JSON.toJSONString(list));
|
||||
YxUpdateUinfoR uinfos = imUserRefClient.getUinfos(req);
|
||||
log.info(JSON.toJSONString(uinfos));
|
||||
}
|
||||
}
|
||||
@@ -179,14 +179,16 @@ public class CurrentUserManager {
|
||||
throw new ServiceException("性别参数异常");
|
||||
}
|
||||
if(user.getGender() != 0 && !user.getGender().equals(res.getGender())){
|
||||
throw new ServiceException("性别不可以修改");
|
||||
throw new ServiceException("性别确定后,无法二次修改");
|
||||
}
|
||||
if(!user.getGender().equals(res.getGender())){
|
||||
update.set(User::getGender,genderEnum.getCode());
|
||||
update.set(User::getAvatar,genderEnum.getDefaultAvatar());
|
||||
imAvatar = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN) + genderEnum.getDefaultAvatar();
|
||||
imGender = genderEnum.getCode();
|
||||
updateFlag=true;
|
||||
updateYunxin=true;
|
||||
}
|
||||
update.set(User::getGender,genderEnum.getCode());
|
||||
update.set(User::getAvatar,genderEnum.getDefaultAvatar());
|
||||
imAvatar = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN);
|
||||
imGender = genderEnum.getCode();
|
||||
updateFlag=true;
|
||||
updateYunxin=true;
|
||||
}
|
||||
if(res.getCityId() != null){
|
||||
update.set(User::getCityId,res.getCityId());
|
||||
|
||||
@@ -71,12 +71,7 @@ public class UserAdminManager {
|
||||
boolean b = userService.updateById(update);
|
||||
if(b){
|
||||
userService.checkFinishStatus(user.getId());
|
||||
String imAvatar = null;
|
||||
if(StringUtils.isNotBlank(userUpdateAdmin.getAvatar())){
|
||||
String cosDomain = systemConfigManager.getSystemConfig(SystemConfigEnum.COS_DOMAIN);
|
||||
imAvatar = cosDomain + userUpdateAdmin.getAvatar();
|
||||
}
|
||||
imManager.updateImInfo(user.getId(),imAvatar,userUpdateAdmin.getNickname(),userUpdateAdmin.getGender());
|
||||
imManager.updateImInfo(user.getId(),userUpdateAdmin.getAvatar(),userUpdateAdmin.getNickname(),userUpdateAdmin.getGender());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ import com.dtflys.forest.annotation.Body;
|
||||
import com.dtflys.forest.annotation.Post;
|
||||
import com.ruoyi.yunxin.interceptor.GlodonTokenInterceptor;
|
||||
import com.ruoyi.yunxin.req.CreateUserReq;
|
||||
import com.ruoyi.yunxin.req.GetUnifoReq;
|
||||
import com.ruoyi.yunxin.req.UpdateUinfoReq;
|
||||
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||
import com.ruoyi.yunxin.resp.YxInfoR;
|
||||
import com.ruoyi.yunxin.resp.YxUpdateUinfoR;
|
||||
|
||||
@BaseRequest(baseURL = "${baseUrl}", interceptor = GlodonTokenInterceptor.class)
|
||||
public interface ImUserRefClient {
|
||||
@@ -16,4 +18,6 @@ public interface ImUserRefClient {
|
||||
@Post(url = "/nimserver/user/updateUinfo.action")
|
||||
YxCommonR updateUinfo(@Body UpdateUinfoReq query);
|
||||
|
||||
@Post(url = "nimserver/user/getUinfos.action")
|
||||
YxUpdateUinfoR getUinfos(@Body GetUnifoReq query);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.ruoyi.yunxin.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GetUnifoReq {
|
||||
private String accids;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.ruoyi.yunxin.resp;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class YxUpdateUinfoR {
|
||||
private Integer code;
|
||||
private List<Uinfos> uinfos;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class Uinfos {
|
||||
|
||||
/**
|
||||
* 账号
|
||||
*/
|
||||
@JsonProperty("accid")
|
||||
private String accid;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@JsonProperty("name")
|
||||
private String name;
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@JsonProperty("icon")
|
||||
private String icon;
|
||||
/**
|
||||
* 签名
|
||||
*/
|
||||
@JsonProperty("sign")
|
||||
private String sign;
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
@JsonProperty("email")
|
||||
private String email;
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@JsonProperty("birth")
|
||||
private String birth;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@JsonProperty("mobile")
|
||||
private String mobile;
|
||||
/**
|
||||
* 扩展信息
|
||||
*/
|
||||
@JsonProperty("ex")
|
||||
private String ex;
|
||||
/**
|
||||
* 性别:0表示未知,1表示男,2表示女
|
||||
*/
|
||||
@JsonProperty("gender")
|
||||
private Integer gender;
|
||||
/**
|
||||
* 账号是否有效
|
||||
*/
|
||||
@JsonProperty("valid")
|
||||
private Boolean valid;
|
||||
/**
|
||||
* 账号是否被全局禁言
|
||||
*/
|
||||
@JsonProperty("mute")
|
||||
private Boolean mute;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user