feat(0): [java]-[wechat-ferry-mvn]-接口出参规范化

This commit is contained in:
chandler 2024-10-06 21:24:12 +08:00
parent 217b7fe632
commit 741b41e17f
5 changed files with 29 additions and 19 deletions

View File

@ -27,17 +27,17 @@ public class WxPpContactsResp {
@ApiModelProperty(value = "微信号") @ApiModelProperty(value = "微信号")
private String weChatNo; private String weChatNo;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String remark;
/** /**
* 微信昵称 * 微信昵称
*/ */
@ApiModelProperty(value = "微信昵称") @ApiModelProperty(value = "微信昵称")
private String nickName; private String weChatNickname;
/**
* 好友备注
*/
@ApiModelProperty(value = "好友备注")
private String friendRemark;
/** /**
* 国家 * 国家

View File

@ -22,10 +22,10 @@ public class WxPpGroupMemberResp {
private String weChatUid; private String weChatUid;
/** /**
* 微信昵称 * 群内昵称
*/ */
@ApiModelProperty(value = "微信昵称") @ApiModelProperty(value = "群内昵称")
private String nickName; private String groupNickName;
/** /**
* 状态 * 状态

View File

@ -22,10 +22,10 @@ public class WxPpLoginInfoResp {
private String weChatUid; private String weChatUid;
/** /**
* name * 微信昵称
*/ */
@ApiModelProperty(value = "name") @ApiModelProperty(value = "微信昵称")
private String name; private String weChatNickname;
/** /**
* 手机号 * 手机号

View File

@ -84,7 +84,7 @@ public class WeChatDllServiceImpl implements WeChatDllService {
Wcf.UserInfo userInfo = wechatSocketClient.getUserInfo(); Wcf.UserInfo userInfo = wechatSocketClient.getUserInfo();
if (!ObjectUtils.isEmpty(userInfo)) { if (!ObjectUtils.isEmpty(userInfo)) {
resp.setWeChatUid(userInfo.getWxid()); resp.setWeChatUid(userInfo.getWxid());
resp.setName(userInfo.getName()); resp.setWeChatNickname(userInfo.getName());
resp.setPhone(userInfo.getMobile()); resp.setPhone(userInfo.getMobile());
resp.setHomePath(userInfo.getHome()); resp.setHomePath(userInfo.getHome());
} }
@ -118,8 +118,8 @@ public class WeChatDllServiceImpl implements WeChatDllService {
WxPpContactsResp vo = new WxPpContactsResp(); WxPpContactsResp vo = new WxPpContactsResp();
vo.setWeChatUid(rpcContact.getWxid()); vo.setWeChatUid(rpcContact.getWxid());
vo.setWeChatNo(rpcContact.getCode()); vo.setWeChatNo(rpcContact.getCode());
vo.setRemark(rpcContact.getRemark()); vo.setFriendRemark(rpcContact.getRemark());
vo.setNickName(rpcContact.getName()); vo.setWeChatNickname(rpcContact.getName());
if (!ObjectUtils.isEmpty(rpcContact.getCountry())) { if (!ObjectUtils.isEmpty(rpcContact.getCountry())) {
vo.setCountryPinyin(rpcContact.getCountry()); vo.setCountryPinyin(rpcContact.getCountry());
if ("CN".equals(rpcContact.getCountry())) { if ("CN".equals(rpcContact.getCountry())) {
@ -282,8 +282,8 @@ public class WeChatDllServiceImpl implements WeChatDllService {
} }
if ("NickName".equals(dbField.getColumn())) { if ("NickName".equals(dbField.getColumn())) {
String content = (String)converterSqlVal(dbField.getType(), dbField.getContent()); String content = (String)converterSqlVal(dbField.getType(), dbField.getContent());
vo.setNickName(content); vo.setGroupNickName(content);
dbMap.put(vo.getWeChatUid(), vo.getNickName()); dbMap.put(vo.getWeChatUid(), vo.getGroupNickName());
} }
} }
} }
@ -309,7 +309,7 @@ public class WeChatDllServiceImpl implements WeChatDllService {
// 如果没有设置群昵称则默认为微信名称 // 如果没有设置群昵称则默认为微信名称
nickName = dbMap.get(member.getWxid()); nickName = dbMap.get(member.getWxid());
} }
vo.setNickName(nickName); vo.setGroupNickName(nickName);
vo.setState(String.valueOf(member.getState())); vo.setState(String.valueOf(member.getState()));
list.add(vo); list.add(vo);
} }

View File

@ -4,6 +4,7 @@ import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
@ -12,6 +13,7 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.wechat.ferry.config.WeChatFerryProperties; import com.wechat.ferry.config.WeChatFerryProperties;
import com.wechat.ferry.entity.dto.WxPpMsgDTO; import com.wechat.ferry.entity.dto.WxPpMsgDTO;
import com.wechat.ferry.service.WeChatExtService;
import com.wechat.ferry.service.WeChatMsgService; import com.wechat.ferry.service.WeChatMsgService;
import com.wechat.ferry.utils.HttpClientUtil; import com.wechat.ferry.utils.HttpClientUtil;
@ -27,6 +29,13 @@ import lombok.extern.slf4j.Slf4j;
@Service @Service
public class WeChatMsgServiceImpl implements WeChatMsgService { public class WeChatMsgServiceImpl implements WeChatMsgService {
private WeChatExtService weChatExtService;
@Autowired
public void setWeChatExtService(WeChatExtService weChatExtService) {
this.weChatExtService = weChatExtService;
}
@Resource @Resource
private WeChatFerryProperties weChatFerryProperties; private WeChatFerryProperties weChatFerryProperties;
@ -40,6 +49,7 @@ public class WeChatMsgServiceImpl implements WeChatMsgService {
if (!CollectionUtils.isEmpty(weChatFerryProperties.getOpenMsgGroups())) { if (!CollectionUtils.isEmpty(weChatFerryProperties.getOpenMsgGroups())) {
// 指定处理的群聊 // 指定处理的群聊
if (weChatFerryProperties.getOpenMsgGroups().contains(dto.getRoomId())) { if (weChatFerryProperties.getOpenMsgGroups().contains(dto.getRoomId())) {
weChatExtService.instructSign(dto);
// TODO 这里可以拓展自己需要的功能 // TODO 这里可以拓展自己需要的功能
} }
} }