开发消息通知功能
This commit is contained in:
@@ -11,6 +11,7 @@ import com.dd.admin.business.file.service.FileService;
|
||||
import com.dd.admin.business.follow.service.FollowService;
|
||||
import com.dd.admin.business.note.service.NoteService;
|
||||
import com.dd.admin.business.noteImg.service.NoteImgService;
|
||||
import com.dd.admin.business.receive.service.ReceiveService;
|
||||
import com.dd.admin.business.reply.service.ReplyService;
|
||||
import com.dd.admin.business.starNotes.service.StarNotesService;
|
||||
import com.dd.admin.business.upNotes.service.UpNotesService;
|
||||
@@ -48,6 +49,8 @@ public class AuthChatApi {
|
||||
ReplyService replyService;
|
||||
@Autowired
|
||||
FollowService followService;
|
||||
@Autowired
|
||||
ReceiveService receiveService;
|
||||
|
||||
@ApiOperation(value = "获取消息列表")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@@ -135,8 +138,9 @@ public class AuthChatApi {
|
||||
Integer starNotesUnReadCount = starNotesService.selectUnReadCount(loginId);
|
||||
Integer replyUnReadCount = replyService.selectUnReadCount(loginId);
|
||||
Integer followUnReadCount = followService.selectUnReadCount(loginId);
|
||||
Integer receiveUnReadCount = receiveService.selectUnReadCount(loginId);
|
||||
Integer totalUnReadCount = 0;
|
||||
UnReadCountBean unReadCountBean = new UnReadCountBean(chatUnReadCount,upNotesUnReadCount,starNotesUnReadCount,replyUnReadCount,followUnReadCount,totalUnReadCount);
|
||||
UnReadCountBean unReadCountBean = new UnReadCountBean(chatUnReadCount,upNotesUnReadCount,starNotesUnReadCount,replyUnReadCount,followUnReadCount,receiveUnReadCount,totalUnReadCount);
|
||||
unReadCountBean.calculateTotalUnReadCount();
|
||||
return ResultBean.success(unReadCountBean);
|
||||
};
|
||||
|
96
src/main/java/com/dd/admin/business/api/AuthNoticeApi.java
Normal file
96
src/main/java/com/dd/admin/business/api/AuthNoticeApi.java
Normal file
@@ -0,0 +1,96 @@
|
||||
package com.dd.admin.business.api;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.dd.admin.business.author.entity.Author;
|
||||
import com.dd.admin.business.author.service.AuthorService;
|
||||
import com.dd.admin.business.chat.domain.AuthorParam;
|
||||
import com.dd.admin.business.file.entity.File;
|
||||
import com.dd.admin.business.file.service.FileService;
|
||||
import com.dd.admin.business.follow.entity.Follow;
|
||||
import com.dd.admin.business.follow.service.FollowService;
|
||||
import com.dd.admin.business.note.domain.NoteDto;
|
||||
import com.dd.admin.business.note.domain.NoteVo;
|
||||
import com.dd.admin.business.note.domain.ReplayMeVo;
|
||||
import com.dd.admin.business.note.domain.UpMeVo;
|
||||
import com.dd.admin.business.note.entity.Note;
|
||||
import com.dd.admin.business.note.service.NoteService;
|
||||
import com.dd.admin.business.noteImg.entity.NoteImg;
|
||||
import com.dd.admin.business.noteImg.service.NoteImgService;
|
||||
import com.dd.admin.business.receive.domain.ReceiveDto;
|
||||
import com.dd.admin.business.receive.domain.ReceiveVo;
|
||||
import com.dd.admin.business.receive.entity.Receive;
|
||||
import com.dd.admin.business.receive.service.ReceiveService;
|
||||
import com.dd.admin.business.reply.domain.ReplyDto;
|
||||
import com.dd.admin.business.reply.domain.ReplyVo;
|
||||
import com.dd.admin.business.reply.service.ReplyService;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperLog;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.dd.admin.common.utils.AddressUtils;
|
||||
import com.dd.admin.common.utils.CommonUtil;
|
||||
import com.dd.admin.common.utils.IPUtils;
|
||||
import com.dd.admin.common.utils.StringUtil;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ApiModel("笔记相关Api")
|
||||
@RestController
|
||||
public class AuthNoticeApi {
|
||||
@Autowired
|
||||
HttpServletRequest request;
|
||||
@Autowired
|
||||
ReceiveService receiveService;
|
||||
|
||||
@ApiOperation(value = "读取系统消息")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@PostMapping("/api/auth/readAuthorReceive")
|
||||
@OperLog(operModule = "读取系统消息", operType = OperType.OTHER, operDesc = "读取系统消息")
|
||||
public ResultBean readAuthorReceive() {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
receiveService.readMessage(authorId);
|
||||
return ResultBean.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取所有系统消息")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/auth/getReceivePage")
|
||||
@OperLog(operModule = "获取所有系统消息", operType = OperType.QUERY, operDesc = "获取所有系统消息")
|
||||
public ResultBean<IPage<ReceiveVo>> getReceivePage() {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
ReceiveDto receiveDto = new ReceiveDto();
|
||||
receiveDto.setAuthorId(authorId);
|
||||
// 1. 通过noteService根据传入的NoteDto参数查询笔记的分页信息,获取包含笔记数据的分页对象
|
||||
IPage<ReceiveVo> receiveVoIPage = receiveService.selectReceivePage(receiveDto);
|
||||
// 20. 将处理好的包含笔记信息(已设置点赞状态和点赞数量)的分页对象包装在ResultBean中返回,以便前端或其他调用方获取处理后的结果数据
|
||||
return ResultBean.success(receiveVoIPage);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "获取最后一条系统消息")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/api/auth/getReceiveLast")
|
||||
@OperLog(operModule = "获取最后一条系统消息", operType = OperType.QUERY, operDesc = "获取最后一条系统消息")
|
||||
public ResultBean<ReceiveVo> getReceiveLast() {
|
||||
String authorId = String.valueOf(request.getAttribute("authorId"));
|
||||
// 1. 通过noteService根据传入的NoteDto参数查询笔记的分页信息,获取包含笔记数据的分页对象
|
||||
ReceiveVo lastReceive = receiveService.selectReceiveLast(authorId);
|
||||
// 20. 将处理好的包含笔记信息(已设置点赞状态和点赞数量)的分页对象包装在ResultBean中返回,以便前端或其他调用方获取处理后的结果数据
|
||||
return ResultBean.success(lastReceive);
|
||||
}
|
||||
}
|
@@ -13,6 +13,7 @@ public class UnReadCountBean {
|
||||
private Integer starNotesUnReadCount;
|
||||
private Integer replyUnReadCount;
|
||||
private Integer followUnReadCount;
|
||||
private Integer receiveUnReadCount;
|
||||
private Integer totalUnReadCount;
|
||||
|
||||
// 自定义方法,用于计算总数量(也可以在构造函数等其他地方调用此方法来计算总和)
|
||||
@@ -22,7 +23,8 @@ public class UnReadCountBean {
|
||||
int starNotesCount = starNotesUnReadCount!= null? starNotesUnReadCount : 0;
|
||||
int replyCount = replyUnReadCount!= null? replyUnReadCount : 0;
|
||||
int followCount = followUnReadCount!= null? followUnReadCount : 0;
|
||||
int receiveCount = receiveUnReadCount!= null? receiveUnReadCount : 0;
|
||||
|
||||
totalUnReadCount = chatCount + upNotesCount + starNotesCount + replyCount + followCount;
|
||||
totalUnReadCount = chatCount + upNotesCount + starNotesCount + replyCount + followCount + receiveCount;
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,126 @@
|
||||
package com.dd.admin.business.notice.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.dd.admin.business.author.entity.Author;
|
||||
import com.dd.admin.business.note.service.NoteService;
|
||||
import com.dd.admin.business.notice.domain.SendNoticeDto;
|
||||
import com.dd.admin.business.receive.entity.Receive;
|
||||
import com.dd.admin.business.receive.service.ReceiveService;
|
||||
import com.dd.admin.common.exception.ApiException;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.dd.admin.common.model.UpdateGroup;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.dd.admin.business.notice.entity.Notice;
|
||||
import com.dd.admin.business.notice.domain.NoticeVo;
|
||||
import com.dd.admin.business.notice.domain.NoticeDto;
|
||||
import com.dd.admin.business.notice.service.NoticeService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 通知公告表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Api(tags = "通知公告表")
|
||||
@RestController
|
||||
public class NoticeController {
|
||||
|
||||
@Autowired
|
||||
NoticeService noticeService;
|
||||
|
||||
@Autowired
|
||||
ReceiveService receiveService;
|
||||
|
||||
@ApiOperation(value = "通知公告表-添加")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@PostMapping("/admin/notice/sendNotice")
|
||||
public ResultBean<Notice> sendNotice(@RequestBody @Validated SendNoticeDto sendNoticeDto) {
|
||||
System.out.println(sendNoticeDto);
|
||||
if(CollectionUtil.isNotEmpty(sendNoticeDto.getAuthorList())){
|
||||
Notice notice = noticeService.getById(sendNoticeDto.getNoticeId());
|
||||
List<Author> authorList = sendNoticeDto.getAuthorList();
|
||||
|
||||
List<Receive> receiveList = new ArrayList<>();
|
||||
authorList.stream().forEach(author -> {
|
||||
Receive receive = new Receive();
|
||||
receive.setNoticeId(notice.getNoticeId());
|
||||
receive.setAuthorId(author.getAuthorId());
|
||||
receive.setAuthorName(author.getAuthorName());
|
||||
receiveList.add(receive);
|
||||
});
|
||||
|
||||
receiveService.saveBatch(receiveList);
|
||||
|
||||
}else{
|
||||
throw new ApiException("请选择发送对象~");
|
||||
}
|
||||
|
||||
return ResultBean.success();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知公告表-分页列表")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/admin/notice/page")
|
||||
public ResultBean<IPage<NoticeVo>> page(NoticeDto noticeDto) {
|
||||
IPage<NoticeVo> pageInfo = noticeService.selectNoticePage(noticeDto);
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知公告表-列表")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@GetMapping("/admin/notice/list")
|
||||
public ResultBean<List<NoticeVo>> list(NoticeDto noticeDto) {
|
||||
List<NoticeVo> list = noticeService.selectNoticeList(noticeDto);
|
||||
return ResultBean.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知公告表-添加")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@PostMapping("/admin/notice/add")
|
||||
public ResultBean<Notice> add(@RequestBody @Validated NoticeDto noticeDto) {
|
||||
Notice notice = BeanUtil.copyProperties(noticeDto, Notice.class);
|
||||
noticeService.save(notice);
|
||||
return ResultBean.success(notice);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知公告表-查询")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@GetMapping("/admin/notice/{noticeId}")
|
||||
public ResultBean<NoticeVo> get(@PathVariable @NotBlank String noticeId) {
|
||||
Notice notice = noticeService.getById(noticeId);
|
||||
NoticeVo noticeVo = BeanUtil.copyProperties(notice,NoticeVo.class);
|
||||
return ResultBean.success(noticeVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知公告表-修改")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@PostMapping("/admin/notice/update")
|
||||
public ResultBean<Notice> update(@RequestBody @Validated(UpdateGroup.class) NoticeDto noticeDto) {
|
||||
Notice notice = BeanUtil.copyProperties(noticeDto, Notice.class);
|
||||
noticeService.updateById(notice);
|
||||
return ResultBean.success(notice);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知公告表-删除")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@GetMapping("/admin/notice/delete/{noticeId}")
|
||||
public ResultBean<Notice> delete(@PathVariable @NotBlank String noticeId) {
|
||||
Boolean b = noticeService.removeById(noticeId);
|
||||
return ResultBean.success(b);
|
||||
}
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
package com.dd.admin.business.notice.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.dd.admin.common.model.UpdateGroup;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 通知公告表返回对象
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="通知公告表接收对象")
|
||||
public class NoticeDto {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "通知id")
|
||||
private String noticeId;
|
||||
|
||||
@ApiModelProperty(value = "通知标题")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty(value = "通知内容")
|
||||
private String noticeContent;
|
||||
|
||||
@ApiModelProperty(value = "跳转url")
|
||||
private String redirectUrl;
|
||||
|
||||
@ApiModelProperty(value = "乐观锁字段")
|
||||
private Long version;
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "门店id")
|
||||
private String shopId;
|
||||
|
||||
@ApiModelProperty(value = "门店名")
|
||||
private String shopName;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人id")
|
||||
private String createId;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private String updateName;
|
||||
|
||||
@ApiModelProperty(value = "修改人id")
|
||||
private String updateId;
|
||||
|
||||
@ApiModelProperty(value = "通知类型")
|
||||
private Integer noticeType;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,74 @@
|
||||
package com.dd.admin.business.notice.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 通知公告表返回对象
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="通知公告表返回对象")
|
||||
public class NoticeVo {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "通知id")
|
||||
private String noticeId;
|
||||
|
||||
@ApiModelProperty(value = "通知标题")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty(value = "通知内容")
|
||||
private String noticeContent;
|
||||
|
||||
@ApiModelProperty(value = "跳转url")
|
||||
private String redirectUrl;
|
||||
|
||||
@ApiModelProperty(value = "乐观锁字段")
|
||||
private Long version;
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "门店id")
|
||||
private String shopId;
|
||||
|
||||
@ApiModelProperty(value = "门店名")
|
||||
private String shopName;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人id")
|
||||
private String createId;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private String updateName;
|
||||
|
||||
@ApiModelProperty(value = "修改人id")
|
||||
private String updateId;
|
||||
|
||||
@ApiModelProperty(value = "通知类型")
|
||||
private Integer noticeType;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.dd.admin.business.notice.domain;
|
||||
|
||||
import com.dd.admin.business.author.entity.Author;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 通知公告表返回对象
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="通知公告表接收对象")
|
||||
public class SendNoticeDto {
|
||||
|
||||
@ApiModelProperty(value = "通知id")
|
||||
private String noticeId;
|
||||
|
||||
@ApiModelProperty(value = "作者集合 没有则全部发布")
|
||||
private List<Author> authorList;
|
||||
|
||||
}
|
@@ -0,0 +1,91 @@
|
||||
package com.dd.admin.business.notice.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 通知公告表
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("business_notice")
|
||||
@ApiModel(value="Notice对象", description="通知公告表")
|
||||
public class Notice implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "通知id")
|
||||
@TableId(value = "NOTICE_ID", type = IdType.ASSIGN_UUID)
|
||||
private String noticeId;
|
||||
|
||||
@ApiModelProperty(value = "通知标题")
|
||||
@TableField("NOTICE_TITLE")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty(value = "通知内容")
|
||||
@TableField("NOTICE_CONTENT")
|
||||
private String noticeContent;
|
||||
|
||||
@ApiModelProperty(value = "跳转url")
|
||||
@TableField("REDIRECT_URL")
|
||||
private String redirectUrl;
|
||||
|
||||
@ApiModelProperty(value = "乐观锁字段")
|
||||
@TableField("VERSION")
|
||||
@Version
|
||||
private Long version;
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
@TableField("DELETED")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "门店id")
|
||||
@TableField(value = "SHOP_ID", fill = FieldFill.INSERT)
|
||||
private String shopId;
|
||||
|
||||
@ApiModelProperty(value = "门店名")
|
||||
@TableField(value = "SHOP_NAME", fill = FieldFill.INSERT)
|
||||
private String shopName;
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@TableField(value = "CREATE_NAME", fill = FieldFill.INSERT)
|
||||
private String createName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "创建人id")
|
||||
@TableField(value = "CREATE_ID", fill = FieldFill.INSERT)
|
||||
private String createId;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
@TableField(value = "UPDATE_NAME", fill = FieldFill.UPDATE)
|
||||
private String updateName;
|
||||
|
||||
@ApiModelProperty(value = "修改人id")
|
||||
@TableField(value = "UPDATE_ID", fill = FieldFill.UPDATE)
|
||||
private String updateId;
|
||||
|
||||
@ApiModelProperty(value = "通知类型")
|
||||
@TableField("NOTICE_TYPE")
|
||||
private Integer noticeType;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package com.dd.admin.business.notice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dd.admin.business.notice.entity.Notice;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dd.admin.business.notice.domain.NoticeVo;
|
||||
import com.dd.admin.business.notice.domain.NoticeDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 通知公告表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface NoticeMapper extends BaseMapper<Notice> {
|
||||
|
||||
IPage<NoticeVo> selectNoticePage(Page<NoticeVo> page, @Param("noticeDto") NoticeDto noticeDto);
|
||||
|
||||
List<NoticeVo> selectNoticeList(@Param("noticeDto") NoticeDto noticeDto);
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dd.admin.business.notice.mapper.NoticeMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.dd.admin.business.notice.entity.Notice">
|
||||
<result column="NOTICE_ID" property="noticeId" />
|
||||
<result column="NOTICE_TITLE" property="noticeTitle" />
|
||||
<result column="NOTICE_CONTENT" property="noticeContent" />
|
||||
<result column="REDIRECT_URL" property="redirectUrl" />
|
||||
<result column="VERSION" property="version" />
|
||||
<result column="DELETED" property="deleted" />
|
||||
<result column="SHOP_ID" property="shopId" />
|
||||
<result column="SHOP_NAME" property="shopName" />
|
||||
<result column="CREATE_NAME" property="createName" />
|
||||
<result column="CREATE_TIME" property="createTime" />
|
||||
<result column="CREATE_ID" property="createId" />
|
||||
<result column="UPDATE_TIME" property="updateTime" />
|
||||
<result column="UPDATE_NAME" property="updateName" />
|
||||
<result column="UPDATE_ID" property="updateId" />
|
||||
<result column="NOTICE_TYPE" property="noticeType" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
NOTICE_ID, NOTICE_TITLE, NOTICE_CONTENT, REDIRECT_URL, VERSION, DELETED, SHOP_ID, SHOP_NAME, CREATE_NAME, CREATE_TIME, CREATE_ID, UPDATE_TIME, UPDATE_NAME, UPDATE_ID, NOTICE_TYPE
|
||||
</sql>
|
||||
|
||||
<select id="selectNoticePage" resultType="com.dd.admin.business.notice.domain.NoticeVo">
|
||||
select
|
||||
*
|
||||
from business_notice where 1 = 1
|
||||
</select>
|
||||
|
||||
<select id="selectNoticeList" resultType="com.dd.admin.business.notice.domain.NoticeVo">
|
||||
select
|
||||
*
|
||||
from business_notice where 1 = 1
|
||||
</select>
|
||||
</mapper>
|
@@ -0,0 +1,26 @@
|
||||
package com.dd.admin.business.notice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.dd.admin.business.notice.entity.Notice;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dd.admin.business.notice.domain.NoticeVo;
|
||||
import com.dd.admin.business.notice.domain.NoticeDto;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 通知公告表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
public interface NoticeService extends IService<Notice> {
|
||||
|
||||
//通知公告表-分页列表
|
||||
IPage<NoticeVo> selectNoticePage(NoticeDto noticeDto);
|
||||
|
||||
//通知公告表-列表
|
||||
List<NoticeVo> selectNoticeList(NoticeDto noticeDto);
|
||||
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package com.dd.admin.business.notice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dd.admin.business.chat.entity.Chat;
|
||||
import com.dd.admin.common.model.PageFactory;
|
||||
import com.dd.admin.business.notice.entity.Notice;
|
||||
import com.dd.admin.business.notice.mapper.NoticeMapper;
|
||||
import com.dd.admin.business.notice.service.NoticeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.dd.admin.business.notice.domain.NoticeVo;
|
||||
import com.dd.admin.business.notice.domain.NoticeDto;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 通知公告表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Service
|
||||
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {
|
||||
|
||||
@Override
|
||||
public IPage<NoticeVo> selectNoticePage(NoticeDto noticeDto) {
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectNoticePage(page,noticeDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NoticeVo> selectNoticeList(NoticeDto noticeDto) {
|
||||
return baseMapper.selectNoticeList(noticeDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,94 @@
|
||||
package com.dd.admin.business.receive.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.dd.admin.business.chat.domain.AuthorParam;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperLog;
|
||||
import com.dd.admin.common.aop.operationLog.aop.OperType;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.dd.admin.common.model.UpdateGroup;
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.dd.admin.business.receive.entity.Receive;
|
||||
import com.dd.admin.business.receive.domain.ReceiveVo;
|
||||
import com.dd.admin.business.receive.domain.ReceiveDto;
|
||||
import com.dd.admin.business.receive.service.ReceiveService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 接收消息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Api(tags = "接收消息表")
|
||||
@RestController
|
||||
public class ReceiveController {
|
||||
|
||||
@Autowired
|
||||
ReceiveService receiveService;
|
||||
|
||||
@ApiOperation(value = "接收消息表-分页列表")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@GetMapping("/admin/receive/page")
|
||||
public ResultBean<IPage<ReceiveVo>> page(ReceiveDto receiveDto) {
|
||||
IPage<ReceiveVo> pageInfo = receiveService.selectReceivePage(receiveDto);
|
||||
return ResultBean.success(pageInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "接收消息表-列表")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@GetMapping("/admin/receive/list")
|
||||
public ResultBean<List<ReceiveVo>> list(ReceiveDto receiveDto) {
|
||||
List<ReceiveVo> list = receiveService.selectReceiveList(receiveDto);
|
||||
return ResultBean.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "接收消息表-添加")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@PostMapping("/admin/receive/add")
|
||||
public ResultBean<Receive> add(@RequestBody @Validated ReceiveDto receiveDto) {
|
||||
Receive receive = BeanUtil.copyProperties(receiveDto, Receive.class);
|
||||
receiveService.save(receive);
|
||||
return ResultBean.success(receive);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "接收消息表-查询")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@GetMapping("/admin/receive/{receiveId}")
|
||||
public ResultBean<ReceiveVo> get(@PathVariable @NotBlank String receiveId) {
|
||||
Receive receive = receiveService.getById(receiveId);
|
||||
ReceiveVo receiveVo = BeanUtil.copyProperties(receive,ReceiveVo.class);
|
||||
return ResultBean.success(receiveVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "接收消息表-修改")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@PostMapping("/admin/receive/update")
|
||||
public ResultBean<Receive> update(@RequestBody @Validated(UpdateGroup.class) ReceiveDto receiveDto) {
|
||||
Receive receive = BeanUtil.copyProperties(receiveDto, Receive.class);
|
||||
receiveService.updateById(receive);
|
||||
return ResultBean.success(receive);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "接收消息表-删除")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@GetMapping("/admin/receive/delete/{receiveId}")
|
||||
public ResultBean<Receive> delete(@PathVariable @NotBlank String receiveId) {
|
||||
Boolean b = receiveService.removeById(receiveId);
|
||||
return ResultBean.success(b);
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package com.dd.admin.business.receive.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import com.dd.admin.common.model.UpdateGroup;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 接收消息表返回对象
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="接收消息表接收对象")
|
||||
public class ReceiveDto {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "接收id")
|
||||
@NotBlank(message = "接收消息表id不能为空",groups = UpdateGroup.class)
|
||||
private String receiveId;
|
||||
|
||||
@ApiModelProperty(value = "博主id")
|
||||
private String authorId;
|
||||
|
||||
@ApiModelProperty(value = "博主名")
|
||||
private String authorName;
|
||||
|
||||
@ApiModelProperty(value = "通知id")
|
||||
private String noticeId;
|
||||
|
||||
@ApiModelProperty(value = "通知标题")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "0 发送 1已读")
|
||||
private Integer receiveStatus;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package com.dd.admin.business.receive.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 接收消息表返回对象
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value="接收消息表返回对象")
|
||||
public class ReceiveVo {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "接收id")
|
||||
private String receiveId;
|
||||
|
||||
@ApiModelProperty(value = "博主id")
|
||||
private String authorId;
|
||||
|
||||
@ApiModelProperty(value = "博主名")
|
||||
private String authorName;
|
||||
|
||||
@ApiModelProperty(value = "通知id")
|
||||
private String noticeId;
|
||||
|
||||
@ApiModelProperty(value = "通知标题")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty(value = "通知标题")
|
||||
private String noticeContent;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "0 发送 1已读")
|
||||
private Integer receiveStatus;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,71 @@
|
||||
package com.dd.admin.business.receive.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.Version;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 接收消息表
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("business_receive")
|
||||
@ApiModel(value="Receive对象", description="接收消息表")
|
||||
public class Receive implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "接收id")
|
||||
@TableId(value = "RECEIVE_ID", type = IdType.ASSIGN_UUID)
|
||||
private String receiveId;
|
||||
|
||||
@ApiModelProperty(value = "博主id")
|
||||
@TableField("AUTHOR_ID")
|
||||
private String authorId;
|
||||
|
||||
@ApiModelProperty(value = "博主名")
|
||||
@TableField("AUTHOR_NAME")
|
||||
private String authorName;
|
||||
|
||||
@ApiModelProperty(value = "通知id")
|
||||
@TableField("NOTICE_ID")
|
||||
private String noticeId;
|
||||
|
||||
@ApiModelProperty(value = "通知标题")
|
||||
@TableField("NOTICE_TITLE")
|
||||
private String noticeTitle;
|
||||
|
||||
@ApiModelProperty(value = "0正常 1删除")
|
||||
@TableField("DELETED")
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField(value = "CREATE_TIME", fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField(value = "UPDATE_TIME", fill = FieldFill.UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "0 发送 1已读")
|
||||
@TableField("RECEIVE_STATUS")
|
||||
private Integer receiveStatus;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.dd.admin.business.receive.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dd.admin.business.receive.entity.Receive;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dd.admin.business.receive.domain.ReceiveVo;
|
||||
import com.dd.admin.business.receive.domain.ReceiveDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 接收消息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReceiveMapper extends BaseMapper<Receive> {
|
||||
|
||||
IPage<ReceiveVo> selectReceivePage(Page<ReceiveVo> page, @Param("receiveDto") ReceiveDto receiveDto);
|
||||
|
||||
List<ReceiveVo> selectReceiveList(@Param("receiveDto") ReceiveDto receiveDto);
|
||||
|
||||
ReceiveVo selectReceiveLast(@Param("authorId")String authorId);
|
||||
}
|
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dd.admin.business.receive.mapper.ReceiveMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.dd.admin.business.receive.entity.Receive">
|
||||
<id column="RECEIVE_ID" property="receiveId" />
|
||||
<result column="AUTHOR_ID" property="authorId" />
|
||||
<result column="AURHOR_NAME" property="aurhorName" />
|
||||
<result column="NOTICE_ID" property="noticeId" />
|
||||
<result column="NOTICE_TITLE" property="noticeTitle" />
|
||||
<result column="DELETED" property="deleted" />
|
||||
<result column="CREATE_TIME" property="createTime" />
|
||||
<result column="UPDATE_TIME" property="updateTime" />
|
||||
<result column="RECEIVE_STATUS" property="receiveStatus" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
RECEIVE_ID, AUTHOR_ID, AURHOR_NAME, NOTICE_ID, NOTICE_TITLE, DELETED, CREATE_TIME, UPDATE_TIME, RECEIVE_STATUS
|
||||
</sql>
|
||||
|
||||
<select id="selectReceivePage" resultType="com.dd.admin.business.receive.domain.ReceiveVo">
|
||||
select
|
||||
b.notice_title,notice_content,redirect_url, a.*
|
||||
from business_receive a left join business_notice b on a.notice_id = b.notice_id where 1=1
|
||||
<if test="receiveDto.authorId!= null and receiveDto.authorId!= ''">
|
||||
and a.author_id = #{receiveDto.authorId}
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectReceiveList" resultType="com.dd.admin.business.receive.domain.ReceiveVo">
|
||||
select
|
||||
*
|
||||
from business_receive where 1 = 1
|
||||
</select>
|
||||
<select id="selectReceiveLast" resultType="com.dd.admin.business.receive.domain.ReceiveVo"
|
||||
parameterType="java.lang.String">
|
||||
select
|
||||
b.notice_title,notice_content,redirect_url, a.*
|
||||
from business_receive a left join business_notice b on a.notice_id = b.notice_id where 1=1
|
||||
<if test="authorId!= null and authorId!= ''">
|
||||
and a.author_id = #{authorId}
|
||||
</if>
|
||||
order by create_time desc limit 1
|
||||
</select>
|
||||
</mapper>
|
@@ -0,0 +1,32 @@
|
||||
package com.dd.admin.business.receive.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.dd.admin.business.receive.entity.Receive;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dd.admin.business.receive.domain.ReceiveVo;
|
||||
import com.dd.admin.business.receive.domain.ReceiveDto;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 接收消息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
public interface ReceiveService extends IService<Receive> {
|
||||
|
||||
//接收消息表-分页列表
|
||||
IPage<ReceiveVo> selectReceivePage(ReceiveDto receiveDto);
|
||||
|
||||
//接收消息表-列表
|
||||
List<ReceiveVo> selectReceiveList(ReceiveDto receiveDto);
|
||||
|
||||
Integer selectUnReadCount(String authorId);
|
||||
|
||||
ReceiveVo selectReceiveLast(String authorId);
|
||||
|
||||
public void readMessage(String authorId);
|
||||
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package com.dd.admin.business.receive.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dd.admin.business.chat.entity.Chat;
|
||||
import com.dd.admin.business.follow.entity.Follow;
|
||||
import com.dd.admin.business.notice.entity.Notice;
|
||||
import com.dd.admin.common.model.PageFactory;
|
||||
import com.dd.admin.business.receive.entity.Receive;
|
||||
import com.dd.admin.business.receive.mapper.ReceiveMapper;
|
||||
import com.dd.admin.business.receive.service.ReceiveService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.dd.admin.business.receive.domain.ReceiveVo;
|
||||
import com.dd.admin.business.receive.domain.ReceiveDto;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 接收消息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 727869402@qq.com
|
||||
* @since 2025-01-14
|
||||
*/
|
||||
@Service
|
||||
public class ReceiveServiceImpl extends ServiceImpl<ReceiveMapper, Receive> implements ReceiveService {
|
||||
|
||||
@Override
|
||||
public IPage<ReceiveVo> selectReceivePage(ReceiveDto receiveDto) {
|
||||
Page page = PageFactory.defaultPage();
|
||||
return baseMapper.selectReceivePage(page,receiveDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReceiveVo> selectReceiveList(ReceiveDto receiveDto) {
|
||||
return baseMapper.selectReceiveList(receiveDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer selectUnReadCount(String authorId) {
|
||||
LambdaQueryWrapper<Receive> queryWrapper = new LambdaQueryWrapper();
|
||||
queryWrapper.eq(Receive::getAuthorId,authorId);
|
||||
queryWrapper.eq(Receive::getReceiveStatus,0);
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReceiveVo selectReceiveLast(String authorId) {
|
||||
return baseMapper.selectReceiveLast(authorId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readMessage(String authorId) {
|
||||
LambdaUpdateWrapper<Receive> queryWrapper = new LambdaUpdateWrapper();
|
||||
queryWrapper.eq(Receive::getAuthorId,authorId);
|
||||
queryWrapper.set(Receive::getReceiveStatus,1);
|
||||
this.update(queryWrapper);
|
||||
}
|
||||
}
|
@@ -4,6 +4,7 @@ import com.dd.admin.business.api.domain.UnReadCountBean;
|
||||
import com.dd.admin.business.author.service.AuthorService;
|
||||
import com.dd.admin.business.chat.service.ChatService;
|
||||
import com.dd.admin.business.follow.service.FollowService;
|
||||
import com.dd.admin.business.receive.service.ReceiveService;
|
||||
import com.dd.admin.business.reply.service.ReplyService;
|
||||
import com.dd.admin.business.starNotes.service.StarNotesService;
|
||||
import com.dd.admin.business.upNotes.service.UpNotesService;
|
||||
@@ -32,6 +33,8 @@ public class GetApiReadCountMessageHandler implements MsgHandlerInterface {
|
||||
ReplyService replyService;
|
||||
@Autowired
|
||||
FollowService followService;
|
||||
@Autowired
|
||||
ReceiveService receiveService;
|
||||
@Override
|
||||
public Object handler(Map map, ChannelContext context) {
|
||||
String authorId = String.valueOf(map.get("authorId"));
|
||||
@@ -40,8 +43,10 @@ public class GetApiReadCountMessageHandler implements MsgHandlerInterface {
|
||||
Integer starNotesUnReadCount = starNotesService.selectUnReadCount(authorId);
|
||||
Integer replyUnReadCount = replyService.selectUnReadCount(authorId);
|
||||
Integer followUnReadCount = followService.selectUnReadCount(authorId);
|
||||
Integer receiveUnReadCount = receiveService.selectUnReadCount(authorId);
|
||||
|
||||
Integer totalUnReadCount = 0;
|
||||
UnReadCountBean unReadCountBean = new UnReadCountBean(chatUnReadCount,upNotesUnReadCount,starNotesUnReadCount,replyUnReadCount,followUnReadCount,totalUnReadCount);
|
||||
UnReadCountBean unReadCountBean = new UnReadCountBean(chatUnReadCount,upNotesUnReadCount,starNotesUnReadCount,replyUnReadCount,followUnReadCount,receiveUnReadCount,totalUnReadCount);
|
||||
unReadCountBean.calculateTotalUnReadCount();
|
||||
|
||||
TioUtil.sendChatMessageToUser(context.getGroupContext(),authorId,"9",unReadCountBean);
|
||||
|
Reference in New Issue
Block a user