feat:第三方私聊
This commit is contained in:
1 parent
2c48e23dec
commit
be41d903ed
21 files changed
+464
-22
No files matched your search
+3
-4
@@ -1,11 +1,10 @@
|
||||
package com.bx.implatform.controller.third;
|
||||
|
||||
import com.bx.implatform.dto.third.friend.ThirdAddFriendDto;
|
||||
import com.bx.implatform.dto.third.user.ThirdLoginDTO;
|
||||
import com.bx.implatform.dto.third.friend.ThirdAddFriendDTO;
|
||||
import com.bx.implatform.result.Result;
|
||||
import com.bx.implatform.result.ResultUtils;
|
||||
import com.bx.implatform.service.third.ThirdFriendService;
|
||||
import com.bx.implatform.vo.third.ThirdLoginVO;
|
||||
import com.bx.implatform.vo.third.user.ThirdLoginVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -27,7 +26,7 @@ public class ThirdFriendController {
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "添加好友", description = "添加好友")
|
||||
public Result<ThirdLoginVO> addFriend(@Valid @RequestBody ThirdAddFriendDto dto) {
|
||||
public Result<ThirdLoginVO> addFriend(@Valid @RequestBody ThirdAddFriendDTO dto) {
|
||||
thirdFriendService.addFriend(dto);
|
||||
return ResultUtils.success();
|
||||
}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.bx.implatform.controller.third;
|
||||
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageCountDTO;
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageDTO;
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageInfoDTO;
|
||||
import com.bx.implatform.result.Result;
|
||||
import com.bx.implatform.result.ResultUtils;
|
||||
import com.bx.implatform.service.third.ThirdPrivateMsgService;
|
||||
import com.bx.implatform.vo.third.ThirdTableVO;
|
||||
import com.bx.implatform.vo.third.privatemsg.ThirdPrivateMessageVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/third/privateMsg")
|
||||
@Tag(name = "第三方私聊")
|
||||
@RequiredArgsConstructor
|
||||
public class ThirdPrivateMsgController {
|
||||
|
||||
private final ThirdPrivateMsgService thirdPrivateMsgService;
|
||||
|
||||
@PostMapping("/page")
|
||||
@Operation(summary = "查询私聊消息列表", description = "查询私聊消息列表")
|
||||
public Result<ThirdTableVO<ThirdPrivateMessageVO>> page(@Valid @RequestBody ThirdPrivateMessageDTO dto) {
|
||||
ThirdTableVO<ThirdPrivateMessageVO> vo = thirdPrivateMsgService.page(dto);
|
||||
return ResultUtils.success(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
@Operation(summary = "获取私聊消息详细信息", description = "获取私聊消息详细信息")
|
||||
public Result<ThirdPrivateMessageVO> getInfo(@Valid @RequestBody ThirdPrivateMessageInfoDTO dto) {
|
||||
ThirdPrivateMessageVO vo = thirdPrivateMsgService.getInfo(dto);
|
||||
return ResultUtils.success(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/dailyCount")
|
||||
@Operation(summary = "按天统计私聊消息量", description = "按天统计私聊消息量")
|
||||
public Result<List<Map<String, Object>>> getDailyMessageCount(@Valid @RequestBody ThirdPrivateMessageCountDTO dto) {
|
||||
List<Map<String, Object>> vo = thirdPrivateMsgService.getDailyMessageCount(dto);
|
||||
return ResultUtils.success(vo);
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.bx.implatform.controller.third;
|
||||
|
||||
import com.bx.implatform.service.third.ThirdSensitiveService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/third/sensitive")
|
||||
@Tag(name = "第三方敏感词")
|
||||
@RequiredArgsConstructor
|
||||
public class ThirdSensitiveController {
|
||||
|
||||
private final ThirdSensitiveService thirdSensitiveService;
|
||||
|
||||
}
|
||||
+3
-3
@@ -6,8 +6,8 @@ import com.bx.implatform.dto.third.user.ThirdLoginDTO;
|
||||
import com.bx.implatform.result.Result;
|
||||
import com.bx.implatform.result.ResultUtils;
|
||||
import com.bx.implatform.service.third.ThirdUserService;
|
||||
import com.bx.implatform.vo.third.ThirdGetUserByUserIdVo;
|
||||
import com.bx.implatform.vo.third.ThirdLoginVO;
|
||||
import com.bx.implatform.vo.third.user.ThirdGetUserByUserIdVO;
|
||||
import com.bx.implatform.vo.third.user.ThirdLoginVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
@@ -33,7 +33,7 @@ public class ThirdUserController {
|
||||
|
||||
@PostMapping("/getUserByUserId")
|
||||
@Operation(summary = "根据userId查询用户详情", description = "根据userId查询用户详情")
|
||||
public Result<ThirdGetUserByUserIdVo> getUserByUserId(@Valid @RequestBody ThirdGetUserByUserIdDTO dto) {
|
||||
public Result<ThirdGetUserByUserIdVO> getUserByUserId(@Valid @RequestBody ThirdGetUserByUserIdDTO dto) {
|
||||
return ResultUtils.success(thirdUserService.getUserByUserId(dto));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "third添加朋友DTO")
|
||||
public class ThirdAddFriendDto {
|
||||
public class ThirdAddFriendDTO {
|
||||
|
||||
@NotNull(message = "用户id不存在")
|
||||
@Schema(description = "用户id")
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.bx.implatform.dto.third.privatemsg;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "third私聊记录DTO")
|
||||
public class ThirdPrivateMessageCountDTO {
|
||||
|
||||
@NotNull(message = "统计天数不存在")
|
||||
@Schema(description = "统计天数")
|
||||
private Integer days;
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package com.bx.implatform.dto.third.privatemsg;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Schema(description = "third私聊记录DTO")
|
||||
public class ThirdPrivateMessageDTO {
|
||||
|
||||
@Schema(description = "分页大小")
|
||||
private Integer pageSize;
|
||||
|
||||
@Schema(description = "当前页数")
|
||||
private Integer pageNum;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "发送用户id")
|
||||
private Long sendId;
|
||||
|
||||
@Schema(description = "接收用户id")
|
||||
private Long recvId;
|
||||
|
||||
@Schema(description = "发送内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "消息类型 0:文字 1:图片 2:文件")
|
||||
private Long type;
|
||||
|
||||
@Schema(description = "状态 0:未读 1:已读")
|
||||
private Long status;
|
||||
|
||||
@Schema(description = "发送时间")
|
||||
private Date sendTime;
|
||||
|
||||
@Schema(description = "请求参数")
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.bx.implatform.dto.third.privatemsg;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "third私聊记录详情DTO")
|
||||
public class ThirdPrivateMessageInfoDTO {
|
||||
|
||||
@NotNull(message = "msgId不存在")
|
||||
@Schema(description = "msgId")
|
||||
private Long msgId;
|
||||
|
||||
}
|
||||
@@ -2,7 +2,20 @@ package com.bx.implatform.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bx.implatform.entity.PrivateMessage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PrivateMessageMapper extends BaseMapper<PrivateMessage> {
|
||||
|
||||
@Select("SELECT DATE(send_time) as date, COUNT(*) as count " +
|
||||
"FROM im_private_message " +
|
||||
"WHERE send_time >= DATE_SUB(CURDATE(), INTERVAL #{days} DAY) " +
|
||||
"GROUP BY DATE(send_time) " +
|
||||
"ORDER BY date ASC"
|
||||
)
|
||||
List<Map<String, Object>> getDailyMessageCount(@Param("days") Integer days);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.bx.implatform.service.third;
|
||||
|
||||
import com.bx.implatform.dto.third.friend.ThirdAddFriendDto;
|
||||
import com.bx.implatform.dto.third.friend.ThirdAddFriendDTO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
public interface ThirdFriendService {
|
||||
@@ -8,6 +8,6 @@ public interface ThirdFriendService {
|
||||
/**
|
||||
* 添加好友
|
||||
*/
|
||||
void addFriend(@Valid ThirdAddFriendDto dto);
|
||||
void addFriend(@Valid ThirdAddFriendDTO dto);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.bx.implatform.service.third;
|
||||
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageCountDTO;
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageDTO;
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageInfoDTO;
|
||||
import com.bx.implatform.vo.third.ThirdTableVO;
|
||||
import com.bx.implatform.vo.third.privatemsg.ThirdPrivateMessageVO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ThirdPrivateMsgService {
|
||||
|
||||
/**
|
||||
* 查询私聊消息列表
|
||||
*/
|
||||
ThirdTableVO<ThirdPrivateMessageVO> page(@Valid ThirdPrivateMessageDTO dto);
|
||||
|
||||
/**
|
||||
* 获取私聊消息详细信息
|
||||
*/
|
||||
ThirdPrivateMessageVO getInfo(@Valid ThirdPrivateMessageInfoDTO dto);
|
||||
|
||||
/**
|
||||
* 按天统计私聊消息量
|
||||
*/
|
||||
List<Map<String, Object>> getDailyMessageCount(@Valid ThirdPrivateMessageCountDTO dto);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.bx.implatform.service.third;
|
||||
|
||||
public interface ThirdSensitiveService {
|
||||
|
||||
}
|
||||
@@ -5,8 +5,8 @@ import com.bx.implatform.dto.third.user.ThirdCreateOrUpdateUserDTO;
|
||||
import com.bx.implatform.dto.third.user.ThirdGetUserByUserIdDTO;
|
||||
import com.bx.implatform.dto.third.user.ThirdLoginDTO;
|
||||
import com.bx.implatform.entity.User;
|
||||
import com.bx.implatform.vo.third.ThirdGetUserByUserIdVo;
|
||||
import com.bx.implatform.vo.third.ThirdLoginVO;
|
||||
import com.bx.implatform.vo.third.user.ThirdGetUserByUserIdVO;
|
||||
import com.bx.implatform.vo.third.user.ThirdLoginVO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
public interface ThirdUserService extends IService<User> {
|
||||
@@ -24,5 +24,5 @@ public interface ThirdUserService extends IService<User> {
|
||||
/**
|
||||
* 根据userId查询用户详情
|
||||
*/
|
||||
ThirdGetUserByUserIdVo getUserByUserId(@Valid ThirdGetUserByUserIdDTO dto);
|
||||
ThirdGetUserByUserIdVO getUserByUserId(@Valid ThirdGetUserByUserIdDTO dto);
|
||||
}
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.bx.implatform.service.third.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bx.implatform.dto.third.friend.ThirdAddFriendDto;
|
||||
import com.bx.implatform.dto.third.friend.ThirdAddFriendDTO;
|
||||
import com.bx.implatform.entity.Friend;
|
||||
import com.bx.implatform.mapper.FriendMapper;
|
||||
import com.bx.implatform.service.FriendService;
|
||||
@@ -24,7 +24,7 @@ public class ThirdFriendServiceImpl extends ServiceImpl<FriendMapper, Friend> im
|
||||
* 添加好友
|
||||
*/
|
||||
@Override
|
||||
public void addFriend(ThirdAddFriendDto dto) {
|
||||
public void addFriend(ThirdAddFriendDTO dto) {
|
||||
friendService.bindFriend(dto.getUserId(), dto.getTargetUserId());
|
||||
}
|
||||
|
||||
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package com.bx.implatform.service.third.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageCountDTO;
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageDTO;
|
||||
import com.bx.implatform.dto.third.privatemsg.ThirdPrivateMessageInfoDTO;
|
||||
import com.bx.implatform.entity.PrivateMessage;
|
||||
import com.bx.implatform.mapper.PrivateMessageMapper;
|
||||
import com.bx.implatform.service.third.ThirdPrivateMsgService;
|
||||
import com.bx.implatform.vo.third.ThirdTableVO;
|
||||
import com.bx.implatform.vo.third.privatemsg.ThirdPrivateMessageVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 第三方私聊消息
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ThirdPrivateMsgServiceImpl extends ServiceImpl<PrivateMessageMapper, PrivateMessage> implements ThirdPrivateMsgService {
|
||||
|
||||
/**
|
||||
* 查询私聊消息列表
|
||||
*/
|
||||
@Override
|
||||
public ThirdTableVO<ThirdPrivateMessageVO> page(ThirdPrivateMessageDTO dto) {
|
||||
ThirdTableVO<ThirdPrivateMessageVO> result = new ThirdTableVO<ThirdPrivateMessageVO>();
|
||||
|
||||
Page<PrivateMessage> page = baseMapper.selectPage(new Page(dto.getPageNum(), dto.getPageSize()), buildQueryWrapper(dto));
|
||||
|
||||
result.setTotal(page.getTotal());
|
||||
if (ObjectUtil.isNotEmpty(page.getRecords())) {
|
||||
result.setRows(BeanUtil.copyToList(page.getRecords(), ThirdPrivateMessageVO.class));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取私聊消息详细信息
|
||||
*/
|
||||
@Override
|
||||
public ThirdPrivateMessageVO getInfo(ThirdPrivateMessageInfoDTO dto) {
|
||||
PrivateMessage detail = baseMapper.selectById(dto.getMsgId());
|
||||
if (ObjectUtil.isNotEmpty(detail)) {
|
||||
return BeanUtil.copyProperties(detail, ThirdPrivateMessageVO.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按天统计私聊消息量
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getDailyMessageCount(ThirdPrivateMessageCountDTO dto) {
|
||||
Integer days = dto.getDays();
|
||||
if (ObjectUtil.isEmpty(days) || days <= 0) {
|
||||
days = 7;
|
||||
}
|
||||
return baseMapper.getDailyMessageCount(days);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<PrivateMessage> buildQueryWrapper(ThirdPrivateMessageDTO bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<PrivateMessage> wrapper = Wrappers.lambdaQuery();
|
||||
if (!Objects.isNull(bo.getSendId()) && !Objects.isNull(bo.getRecvId())) {
|
||||
// 指定了两个用户,返回这两个用户之间的聊天记录
|
||||
wrapper.and(wrap -> wrap.and(wp -> wp.eq(PrivateMessage::getSendId, bo.getSendId())
|
||||
.eq(PrivateMessage::getRecvId, bo.getRecvId()))
|
||||
.or(wp -> wp.eq(PrivateMessage::getSendId, bo.getRecvId())
|
||||
.eq(PrivateMessage::getRecvId, bo.getSendId())));
|
||||
|
||||
} else if (!Objects.isNull(bo.getSendId())) {
|
||||
wrapper.and(wp -> wp.eq(PrivateMessage::getSendId, bo.getSendId()).or()
|
||||
.eq(PrivateMessage::getRecvId, bo.getSendId()));
|
||||
} else if (!Objects.isNull(bo.getRecvId())) {
|
||||
wrapper.and(wp -> wp.eq(PrivateMessage::getSendId, bo.getRecvId()).or()
|
||||
.eq(PrivateMessage::getRecvId, bo.getRecvId()));
|
||||
}
|
||||
wrapper.like(ObjUtil.isNotEmpty(bo.getContent()), PrivateMessage::getContent, bo.getContent());
|
||||
wrapper.eq(!Objects.isNull(bo.getType()), PrivateMessage::getType, bo.getType());
|
||||
wrapper.eq(!Objects.isNull(bo.getStatus()), PrivateMessage::getStatus, bo.getStatus());
|
||||
wrapper.between(params.get("beginTime") != null && params.get("endTime") != null, PrivateMessage::getSendTime,
|
||||
params.get("beginTime"), params.get("endTime"));
|
||||
wrapper.orderByDesc(PrivateMessage::getId);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.bx.implatform.service.third.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bx.implatform.entity.SensitiveWord;
|
||||
import com.bx.implatform.mapper.SensitiveWordMapper;
|
||||
import com.bx.implatform.service.third.ThirdSensitiveService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 第三方敏感词
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ThirdSensitiveServiceImpl extends ServiceImpl<SensitiveWordMapper, SensitiveWord> implements ThirdSensitiveService {
|
||||
|
||||
}
|
||||
+4
-4
@@ -14,8 +14,8 @@ import com.bx.implatform.mapper.UserMapper;
|
||||
import com.bx.implatform.service.third.ThirdUserService;
|
||||
import com.bx.implatform.session.UserSession;
|
||||
import com.bx.implatform.util.BeanUtils;
|
||||
import com.bx.implatform.vo.third.ThirdGetUserByUserIdVo;
|
||||
import com.bx.implatform.vo.third.ThirdLoginVO;
|
||||
import com.bx.implatform.vo.third.user.ThirdGetUserByUserIdVO;
|
||||
import com.bx.implatform.vo.third.user.ThirdLoginVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
@@ -85,9 +85,9 @@ public class ThirdUserServiceImpl extends ServiceImpl<UserMapper, User> implemen
|
||||
* 根据userId查询用户详情
|
||||
*/
|
||||
@Override
|
||||
public ThirdGetUserByUserIdVo getUserByUserId(ThirdGetUserByUserIdDTO dto) {
|
||||
public ThirdGetUserByUserIdVO getUserByUserId(ThirdGetUserByUserIdDTO dto) {
|
||||
User user = baseMapper.selectById(dto.getUserId());
|
||||
return BeanUtils.copyProperties(user, ThirdGetUserByUserIdVo.class);
|
||||
return BeanUtils.copyProperties(user, ThirdGetUserByUserIdVO.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.bx.implatform.vo.third;
|
||||
|
||||
import cn.hutool.http.HttpStatus;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 表格分页数据对象
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class ThirdTableVO<T> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 总记录数
|
||||
*/
|
||||
private long total;
|
||||
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
private List<T> rows;
|
||||
|
||||
/**
|
||||
* 消息状态码
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param list 列表数据
|
||||
* @param total 总记录数
|
||||
*/
|
||||
public ThirdTableVO(List<T> list, long total) {
|
||||
this.rows = list;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分页对象构建表格分页数据对象
|
||||
*/
|
||||
public static <T> ThirdTableVO<T> build(IPage<T> page) {
|
||||
ThirdTableVO<T> rspData = new ThirdTableVO<>();
|
||||
rspData.setCode(HttpStatus.HTTP_OK);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(page.getRecords());
|
||||
rspData.setTotal(page.getTotal());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据数据列表构建表格分页数据对象
|
||||
*/
|
||||
public static <T> ThirdTableVO<T> build(List<T> list) {
|
||||
ThirdTableVO<T> rspData = new ThirdTableVO<>();
|
||||
rspData.setCode(HttpStatus.HTTP_OK);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(list);
|
||||
rspData.setTotal(list.size());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建表格分页数据对象
|
||||
*/
|
||||
public static <T> ThirdTableVO<T> build() {
|
||||
ThirdTableVO<T> rspData = new ThirdTableVO<>();
|
||||
rspData.setCode(HttpStatus.HTTP_OK);
|
||||
rspData.setMsg("查询成功");
|
||||
return rspData;
|
||||
}
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.bx.implatform.vo.third.privatemsg;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "third私聊记录VO")
|
||||
public class ThirdPrivateMessageVO {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "发送用户id")
|
||||
private Long sendId;
|
||||
|
||||
@Schema(description = "发送用户")
|
||||
private String sendUserName;
|
||||
|
||||
@Schema(description = "接收用户id")
|
||||
private Long recvId;
|
||||
|
||||
@Schema(description = "接收用户")
|
||||
private String recvUserName;
|
||||
|
||||
@Schema(description = "发送内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "消息类型")
|
||||
private Long type;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private Long status;
|
||||
|
||||
@Schema(description = "发送时间")
|
||||
private Date sendTime;
|
||||
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.bx.implatform.vo.third;
|
||||
package com.bx.implatform.vo.third.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
@@ -8,7 +8,7 @@ import org.hibernate.validator.constraints.Length;
|
||||
|
||||
@Data
|
||||
@Schema(description = "third根据userId查询用户详情VO")
|
||||
public class ThirdGetUserByUserIdVo {
|
||||
public class ThirdGetUserByUserIdVO {
|
||||
|
||||
@NotNull(message = "用户id不能为空")
|
||||
@Schema(description = "id")
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.bx.implatform.vo.third;
|
||||
package com.bx.implatform.vo.third.user;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
Reference in new issue
Block a user