feat(0): [java]-[wechat-ferry-mvn]-登录信息返回字段修改
This commit is contained in:
parent
adcc05dc7c
commit
96e8fbea19
@ -2,6 +2,7 @@ package com.wechat.ferry;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动类
|
* 启动类
|
||||||
@ -9,6 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
* @author chandler
|
* @author chandler
|
||||||
* @date 2024-09-21 12:19
|
* @date 2024-09-21 12:19
|
||||||
*/
|
*/
|
||||||
|
@EnableScheduling
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class WeChatFerryApplication {
|
public class WeChatFerryApplication {
|
||||||
|
|
||||||
|
@ -14,17 +14,18 @@ import com.wechat.ferry.entity.vo.request.WxPpDatabaseSqlReq;
|
|||||||
import com.wechat.ferry.entity.vo.request.WxPpDatabaseTableReq;
|
import com.wechat.ferry.entity.vo.request.WxPpDatabaseTableReq;
|
||||||
import com.wechat.ferry.entity.vo.request.WxPpGroupMemberReq;
|
import com.wechat.ferry.entity.vo.request.WxPpGroupMemberReq;
|
||||||
import com.wechat.ferry.entity.vo.request.WxPpSendCardMsgReq;
|
import com.wechat.ferry.entity.vo.request.WxPpSendCardMsgReq;
|
||||||
import com.wechat.ferry.entity.vo.request.WxPpSendFileMsgReq;
|
|
||||||
import com.wechat.ferry.entity.vo.request.WxPpSendEmojiMsgReq;
|
import com.wechat.ferry.entity.vo.request.WxPpSendEmojiMsgReq;
|
||||||
|
import com.wechat.ferry.entity.vo.request.WxPpSendFileMsgReq;
|
||||||
import com.wechat.ferry.entity.vo.request.WxPpSendImageMsgReq;
|
import com.wechat.ferry.entity.vo.request.WxPpSendImageMsgReq;
|
||||||
import com.wechat.ferry.entity.vo.request.WxPpSendTextMsgReq;
|
import com.wechat.ferry.entity.vo.request.WxPpSendTextMsgReq;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpContactsResp;
|
import com.wechat.ferry.entity.vo.response.WxPpContactsResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
||||||
|
import com.wechat.ferry.entity.vo.response.WxPpLoginInfoResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendFileMsgResp;
|
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
||||||
|
import com.wechat.ferry.entity.vo.response.WxPpSendFileMsgResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendImageMsgResp;
|
import com.wechat.ferry.entity.vo.response.WxPpSendImageMsgResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendTextMsgResp;
|
import com.wechat.ferry.entity.vo.response.WxPpSendTextMsgResp;
|
||||||
import com.wechat.ferry.enums.ResponseCodeEnum;
|
import com.wechat.ferry.enums.ResponseCodeEnum;
|
||||||
@ -60,18 +61,18 @@ public class WeChatDllController {
|
|||||||
return TResponse.ok(ResponseCodeEnum.SUCCESS, status);
|
return TResponse.ok(ResponseCodeEnum.SUCCESS, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取登录微信号", notes = "queryLoginWeChatNo")
|
@ApiOperation(value = "获取登录微信内部识别号UID", notes = "queryLoginWeChatUid")
|
||||||
@PostMapping(value = "/loginWeChatNo")
|
@PostMapping(value = "/loginWeChatUid")
|
||||||
public TResponse<Object> queryLoginWeChatNo() {
|
public TResponse<Object> queryLoginWeChatUid() {
|
||||||
String weChatNo = weChatDllService.queryLoginWeChatId();
|
String weChatUid = weChatDllService.queryLoginWeChatUid();
|
||||||
return TResponse.ok(ResponseCodeEnum.SUCCESS, weChatNo);
|
return TResponse.ok(ResponseCodeEnum.SUCCESS, weChatUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取登录微信信息", notes = "queryLoginWeChatInfo")
|
@ApiOperation(value = "获取登录微信信息", notes = "queryLoginWeChatInfo")
|
||||||
@PostMapping(value = "/loginWeChatInfo")
|
@PostMapping(value = "/loginWeChatInfo")
|
||||||
public TResponse<Object> queryLoginWeChatInfo() {
|
public TResponse<WxPpLoginInfoResp> queryLoginWeChatInfo() {
|
||||||
|
WxPpLoginInfoResp resp = weChatDllService.queryLoginWeChatInfo();
|
||||||
return TResponse.ok(ResponseCodeEnum.SUCCESS);
|
return TResponse.ok(ResponseCodeEnum.SUCCESS, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "获取消息类型", notes = "queryMsgTypeList")
|
@ApiOperation(value = "获取消息类型", notes = "queryMsgTypeList")
|
||||||
|
@ -15,16 +15,17 @@ import lombok.Data;
|
|||||||
public class WxPpContactsResp {
|
public class WxPpContactsResp {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信编号
|
* 微信内部识别号UID
|
||||||
|
* 原始微信账号ID,以"wxid_"开头,初始默认的微信ID=微信号。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "微信编号")
|
@ApiModelProperty(value = "微信内部识别号UID")
|
||||||
private String weChatNo;
|
private String weChatUid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信代码
|
* 微信号
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "微信代码")
|
@ApiModelProperty(value = "微信号")
|
||||||
private String weChatCode;
|
private String weChatNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
|
@ -15,10 +15,11 @@ import lombok.Data;
|
|||||||
public class WxPpGroupMemberResp {
|
public class WxPpGroupMemberResp {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信编号
|
* 微信内部识别号UID
|
||||||
|
* 原始微信账号ID,以"wxid_"开头,初始默认的微信ID=微信号。
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "微信编号")
|
@ApiModelProperty(value = "微信内部识别号UID")
|
||||||
private String weChatNo;
|
private String weChatUid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信昵称
|
* 微信昵称
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.wechat.ferry.entity.vo.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 请求出参-登录个微信息
|
||||||
|
*
|
||||||
|
* @author chandler
|
||||||
|
* @date 2024/10/05 22:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "wxPpLoginInfoResp", description = "登录个微信息查询请求出参")
|
||||||
|
public class WxPpLoginInfoResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信内部识别号UID
|
||||||
|
* 原始微信账号ID,以"wxid_"开头,初始默认的微信ID=微信号。
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "微信内部识别号UID")
|
||||||
|
private String weChatUid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* name
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件/图片等父路径
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "文件/图片等父路径")
|
||||||
|
private String homePath;
|
||||||
|
|
||||||
|
}
|
@ -13,6 +13,7 @@ import com.wechat.ferry.entity.vo.request.WxPpSendTextMsgReq;
|
|||||||
import com.wechat.ferry.entity.vo.response.WxPpContactsResp;
|
import com.wechat.ferry.entity.vo.response.WxPpContactsResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
||||||
|
import com.wechat.ferry.entity.vo.response.WxPpLoginInfoResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
||||||
@ -39,14 +40,24 @@ public interface WeChatDllService {
|
|||||||
Boolean loginStatus();
|
Boolean loginStatus();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得微信客户端登录的微信ID
|
* 获取登录微信内部识别号UID
|
||||||
*
|
*
|
||||||
* @return 微信ID
|
* @return 微信内部识别号UID
|
||||||
*
|
*
|
||||||
* @author chandler
|
* @author chandler
|
||||||
* @date 2024-10-01 21:22
|
* @date 2024-10-01 21:22
|
||||||
*/
|
*/
|
||||||
String queryLoginWeChatId();
|
String queryLoginWeChatUid();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录微信信息
|
||||||
|
*
|
||||||
|
* @return 当前登录微信信息
|
||||||
|
*
|
||||||
|
* @author chandler
|
||||||
|
* @date 2024-10-05 22:54
|
||||||
|
*/
|
||||||
|
WxPpLoginInfoResp queryLoginWeChatInfo();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有消息类型
|
* 获取所有消息类型
|
||||||
|
@ -29,6 +29,7 @@ import com.wechat.ferry.entity.vo.response.WxPpContactsResp;
|
|||||||
import com.wechat.ferry.entity.vo.response.WxPpDatabaseFieldResp;
|
import com.wechat.ferry.entity.vo.response.WxPpDatabaseFieldResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
import com.wechat.ferry.entity.vo.response.WxPpDatabaseRowResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
import com.wechat.ferry.entity.vo.response.WxPpGroupMemberResp;
|
||||||
|
import com.wechat.ferry.entity.vo.response.WxPpLoginInfoResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
import com.wechat.ferry.entity.vo.response.WxPpMsgTypeResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
import com.wechat.ferry.entity.vo.response.WxPpSendCardMsgResp;
|
||||||
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
import com.wechat.ferry.entity.vo.response.WxPpSendEmojiMsgResp;
|
||||||
@ -67,10 +68,24 @@ public class WeChatDllServiceImpl implements WeChatDllService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String queryLoginWeChatId() {
|
public String queryLoginWeChatUid() {
|
||||||
String weChatNo = wechatSocketClient.getSelfWxId();
|
String weChatUid = wechatSocketClient.getSelfWxId();
|
||||||
log.info("[查询]-[登录微信编号]-weChatNo:{}", weChatNo);
|
log.info("[查询]-[登录微信UID]-weChatUid:{}", weChatUid);
|
||||||
return weChatNo;
|
return weChatUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxPpLoginInfoResp queryLoginWeChatInfo() {
|
||||||
|
WxPpLoginInfoResp resp = new WxPpLoginInfoResp();
|
||||||
|
Wcf.UserInfo userInfo = wechatSocketClient.getUserInfo();
|
||||||
|
if (!ObjectUtils.isEmpty(userInfo)) {
|
||||||
|
resp.setWeChatUid(userInfo.getWxid());
|
||||||
|
resp.setName(userInfo.getName());
|
||||||
|
resp.setPhone(userInfo.getMobile());
|
||||||
|
resp.setHomePath(userInfo.getHome());
|
||||||
|
}
|
||||||
|
log.info("[查询]-[获取登录微信信息]-resp:{}", resp);
|
||||||
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,7 +101,7 @@ public class WeChatDllServiceImpl implements WeChatDllService {
|
|||||||
list.add(resp);
|
list.add(resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("[查询]-[所消息类型]-共查到:{}条", list.size());
|
log.info("[查询]-[所有消息类型]-共查到:{}条", list.size());
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,8 +112,8 @@ public class WeChatDllServiceImpl implements WeChatDllService {
|
|||||||
if (!CollectionUtils.isEmpty(rpcContactList)) {
|
if (!CollectionUtils.isEmpty(rpcContactList)) {
|
||||||
for (Wcf.RpcContact rpcContact : rpcContactList) {
|
for (Wcf.RpcContact rpcContact : rpcContactList) {
|
||||||
WxPpContactsResp vo = new WxPpContactsResp();
|
WxPpContactsResp vo = new WxPpContactsResp();
|
||||||
vo.setWeChatNo(rpcContact.getWxid());
|
vo.setWeChatUid(rpcContact.getWxid());
|
||||||
vo.setWeChatCode(rpcContact.getCode());
|
vo.setWeChatNo(rpcContact.getCode());
|
||||||
vo.setRemark(rpcContact.getRemark());
|
vo.setRemark(rpcContact.getRemark());
|
||||||
vo.setNickName(rpcContact.getName());
|
vo.setNickName(rpcContact.getName());
|
||||||
if (!ObjectUtils.isEmpty(rpcContact.getCountry())) {
|
if (!ObjectUtils.isEmpty(rpcContact.getCountry())) {
|
||||||
@ -218,12 +233,12 @@ public class WeChatDllServiceImpl implements WeChatDllService {
|
|||||||
if ("UserName".equals(dbField.getColumn())) {
|
if ("UserName".equals(dbField.getColumn())) {
|
||||||
vo = new WxPpGroupMemberResp();
|
vo = new WxPpGroupMemberResp();
|
||||||
String content = (String)converterSqlVal(dbField.getType(), dbField.getContent());
|
String content = (String)converterSqlVal(dbField.getType(), dbField.getContent());
|
||||||
vo.setWeChatNo(content);
|
vo.setWeChatUid(content);
|
||||||
}
|
}
|
||||||
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.setNickName(content);
|
||||||
dbMap.put(vo.getWeChatNo(), vo.getNickName());
|
dbMap.put(vo.getWeChatUid(), vo.getNickName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,7 +258,7 @@ public class WeChatDllServiceImpl implements WeChatDllService {
|
|||||||
Wcf.RoomData roomData = Wcf.RoomData.parseFrom(roomDataBytes);
|
Wcf.RoomData roomData = Wcf.RoomData.parseFrom(roomDataBytes);
|
||||||
for (Wcf.RoomData.RoomMember member : roomData.getMembersList()) {
|
for (Wcf.RoomData.RoomMember member : roomData.getMembersList()) {
|
||||||
vo = new WxPpGroupMemberResp();
|
vo = new WxPpGroupMemberResp();
|
||||||
vo.setWeChatNo(member.getWxid());
|
vo.setWeChatUid(member.getWxid());
|
||||||
String nickName = member.getName();
|
String nickName = member.getName();
|
||||||
if (ObjectUtils.isEmpty(nickName)) {
|
if (ObjectUtils.isEmpty(nickName)) {
|
||||||
// 如果没有设置群昵称则默认为微信名称
|
// 如果没有设置群昵称则默认为微信名称
|
||||||
|
@ -14,6 +14,7 @@ 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.WeChatDllService;
|
import com.wechat.ferry.service.WeChatDllService;
|
||||||
|
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;
|
||||||
|
|
||||||
@ -36,6 +37,13 @@ public class WeChatMsgServiceImpl implements WeChatMsgService {
|
|||||||
this.weChatDllService = weChatDllService;
|
this.weChatDllService = weChatDllService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WeChatExtService weChatExtService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setWeChatExtService(WeChatExtService weChatExtService) {
|
||||||
|
this.weChatExtService = weChatExtService;
|
||||||
|
}
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private WeChatFerryProperties weChatFerryProperties;
|
private WeChatFerryProperties weChatFerryProperties;
|
||||||
|
|
||||||
@ -50,6 +58,7 @@ public class WeChatMsgServiceImpl implements WeChatMsgService {
|
|||||||
// 指定处理的群聊
|
// 指定处理的群聊
|
||||||
if (weChatFerryProperties.getOpenMsgGroups().contains(dto.getRoomId())) {
|
if (weChatFerryProperties.getOpenMsgGroups().contains(dto.getRoomId())) {
|
||||||
// TODO 这里可以拓展自己需要的功能
|
// TODO 这里可以拓展自己需要的功能
|
||||||
|
weChatExtService.instructSign(dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.debug("[收到消息]-[消息内容]-打印:{}", dto);
|
log.debug("[收到消息]-[消息内容]-打印:{}", dto);
|
||||||
|
Loading…
Reference in New Issue
Block a user