修改消息bug
This commit is contained in:
parent
360caa64f6
commit
c014f65f13
@ -136,6 +136,7 @@ tenant:
|
|||||||
- sys_role_menu
|
- sys_role_menu
|
||||||
- sys_user_post
|
- sys_user_post
|
||||||
- sys_user_role
|
- sys_user_role
|
||||||
|
- sys_message
|
||||||
- sys_client
|
- sys_client
|
||||||
- sys_oss_config
|
- sys_oss_config
|
||||||
- ums_member
|
- ums_member
|
||||||
@ -145,6 +146,7 @@ tenant:
|
|||||||
- ums_cart
|
- ums_cart
|
||||||
- ums_account
|
- ums_account
|
||||||
- ums_account_change_record
|
- ums_account_change_record
|
||||||
|
- sys_message_template
|
||||||
- ums_fans
|
- ums_fans
|
||||||
- ums_block
|
- ums_block
|
||||||
- oms_aftersale
|
- oms_aftersale
|
||||||
|
@ -31,11 +31,11 @@ public class BaseEntity implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String searchValue;
|
private String searchValue;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 创建部门
|
* 创建部门
|
||||||
// */
|
*/
|
||||||
// @TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
// private Long createDept;
|
private Long createDept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建者
|
* 创建者
|
||||||
|
@ -45,7 +45,7 @@ public class InjectionMetaObjectHandler implements MetaObjectHandler {
|
|||||||
// 填充创建人、更新人和创建部门信息
|
// 填充创建人、更新人和创建部门信息
|
||||||
baseEntity.setCreateBy(userId);
|
baseEntity.setCreateBy(userId);
|
||||||
baseEntity.setUpdateBy(userId);
|
baseEntity.setUpdateBy(userId);
|
||||||
// baseEntity.setCreateDept(ObjectUtils.notNull(baseEntity.getCreateDept(), loginUser.getDeptId()));
|
baseEntity.setCreateDept(ObjectUtils.notNull(baseEntity.getCreateDept(), loginUser.getDeptId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package org.dromara.system.controller;
|
package org.dromara.system.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -59,8 +59,9 @@ public class SysMessageController extends BaseController {
|
|||||||
* 查询消息列表
|
* 查询消息列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:message:list")
|
@SaCheckPermission("system:message:list")
|
||||||
|
@Tag(name = "查询消息列表")
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
public R<Page<SysMessageVo>> list(@RequestBody SysMessageBo bo, @RequestBody Page page) {
|
public R<Page<SysMessageVo>> list(@RequestBody SysMessageBo bo, @RequestBody Page<SysMessage> page) {
|
||||||
Page<SysMessage> messagePage = messageService.page(page, bo.toWrapper());
|
Page<SysMessage> messagePage = messageService.page(page, bo.toWrapper());
|
||||||
Page<SysMessageVo> voPage = new Page<>(messagePage.getCurrent(), messagePage.getSize(), messagePage.getTotal());
|
Page<SysMessageVo> voPage = new Page<>(messagePage.getCurrent(), messagePage.getSize(), messagePage.getTotal());
|
||||||
voPage.setRecords(MapstructUtils.convert(messagePage.getRecords(), SysMessageVo.class));
|
voPage.setRecords(MapstructUtils.convert(messagePage.getRecords(), SysMessageVo.class));
|
||||||
@ -149,18 +150,22 @@ public class SysMessageController extends BaseController {
|
|||||||
* 获取未读消息列表
|
* 获取未读消息列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:message:list")
|
@SaCheckPermission("system:message:list")
|
||||||
@GetMapping("/unread")
|
@Tag(name = "查询未读消息列表")
|
||||||
public TableDataInfo<SysMessageVo> unreadList(PageQuery pageQuery) {
|
@PostMapping("/unread")
|
||||||
return messageService.selectPageUnreadMessages(getUserId(), pageQuery);
|
public R<Page<SysMessageVo>> unreadList(@RequestBody Page<SysMessage> page) {
|
||||||
|
Page<SysMessageVo> unreadPage = messageService.selectUnreadMessagesPage(getUserId(), page);
|
||||||
|
return R.ok(unreadPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取已读消息列表
|
* 获取已读消息列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:message:list")
|
@SaCheckPermission("system:message:list")
|
||||||
@GetMapping("/read")
|
@Tag(name = "查询已读消息列表")
|
||||||
public TableDataInfo<SysMessageVo> readList(PageQuery pageQuery) {
|
@PostMapping("/read")
|
||||||
return messageService.selectPageReadMessages(getUserId(), pageQuery);
|
public R<Page<SysMessageVo>> readList(@RequestBody Page<SysMessage> page) {
|
||||||
|
Page<SysMessageVo> readPage = messageService.selectReadMessagesPage(getUserId(), page);
|
||||||
|
return R.ok(readPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
package org.dromara.system.controller;
|
package org.dromara.system.controller;
|
||||||
|
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.system.domain.SysMessageTemplate;
|
||||||
import org.dromara.system.domain.bo.SysMessageTemplateBo;
|
import org.dromara.system.domain.bo.SysMessageTemplateBo;
|
||||||
import org.dromara.system.domain.vo.SysMessageTemplateVo;
|
import org.dromara.system.domain.vo.SysMessageTemplateVo;
|
||||||
import org.dromara.system.service.ISysMessageTemplateService;
|
import org.dromara.system.service.ISysMessageTemplateService;
|
||||||
@ -38,9 +40,13 @@ public class SysMessageTemplateController extends BaseController {
|
|||||||
* 查询消息模板列表
|
* 查询消息模板列表
|
||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:message:template:list")
|
@SaCheckPermission("system:message:template:list")
|
||||||
@GetMapping("/list")
|
@Tag(name = "查询消息模板列表")
|
||||||
public TableDataInfo<SysMessageTemplateVo> list(SysMessageTemplateBo bo, PageQuery pageQuery) {
|
@PostMapping("/list")
|
||||||
return templateService.selectTemplatePage(bo, pageQuery);
|
public R<Page<SysMessageTemplateVo>> list(@RequestBody SysMessageTemplateBo bo, @RequestBody Page<SysMessageTemplate> page) {
|
||||||
|
Page<SysMessageTemplate> templatePage = templateService.page(page, bo.toWrapper());
|
||||||
|
Page<SysMessageTemplateVo> voPage = new Page<>(templatePage.getCurrent(), templatePage.getSize(), templatePage.getTotal());
|
||||||
|
voPage.setRecords(MapstructUtils.convert(templatePage.getRecords(), SysMessageTemplateVo.class));
|
||||||
|
return R.ok(voPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -51,7 +57,8 @@ public class SysMessageTemplateController extends BaseController {
|
|||||||
@SaCheckPermission("system:message:template:query")
|
@SaCheckPermission("system:message:template:query")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<SysMessageTemplateVo> getInfo(@NotNull(message = "消息模板ID不能为空") @PathVariable Long id) {
|
public R<SysMessageTemplateVo> getInfo(@NotNull(message = "消息模板ID不能为空") @PathVariable Long id) {
|
||||||
return R.ok(templateService.selectTemplateById(id));
|
SysMessageTemplate template = templateService.getById(id);
|
||||||
|
return R.ok(MapstructUtils.convert(template, SysMessageTemplateVo.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +69,7 @@ public class SysMessageTemplateController extends BaseController {
|
|||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysMessageTemplateBo bo) {
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody SysMessageTemplateBo bo) {
|
||||||
return toAjax(templateService.insertTemplate(bo));
|
return toAjax(templateService.save(bo.toEntity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +80,7 @@ public class SysMessageTemplateController extends BaseController {
|
|||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysMessageTemplateBo bo) {
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SysMessageTemplateBo bo) {
|
||||||
return toAjax(templateService.updateTemplate(bo));
|
return toAjax(templateService.updateById(bo.toEntity()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,6 +92,6 @@ public class SysMessageTemplateController extends BaseController {
|
|||||||
@Log(title = "消息模板管理", businessType = BusinessType.DELETE)
|
@Log(title = "消息模板管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public R<Void> remove(@NotEmpty(message = "消息模板ID不能为空") @PathVariable Long[] ids) {
|
public R<Void> remove(@NotEmpty(message = "消息模板ID不能为空") @PathVariable Long[] ids) {
|
||||||
return toAjax(templateService.deleteTemplateByIds(ids));
|
return toAjax(templateService.removeByIds(List.of(ids)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.core.domain.model.BaseAudit;
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
import org.dromara.common.tenant.core.TenantEntity;
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ import java.util.Date;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("sys_message")
|
@TableName("sys_message")
|
||||||
public class SysMessage extends BaseEntity {
|
public class SysMessage extends BaseAudit {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.core.domain.model.BaseAudit;
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
import org.dromara.common.tenant.core.TenantEntity;
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ import org.dromara.common.tenant.core.TenantEntity;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("sys_message_template")
|
@TableName("sys_message_template")
|
||||||
public class SysMessageTemplate extends BaseEntity {
|
public class SysMessageTemplate extends BaseAudit {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ -26,9 +27,10 @@ public class SysMessageTemplate extends BaseEntity {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板类型(1通知 2公告 3消息)
|
* 模板类型(0通知 1公告)
|
||||||
*/
|
*/
|
||||||
private String templateType;
|
private String templateType;
|
||||||
|
private String title;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板编码
|
* 模板编码
|
||||||
@ -40,23 +42,24 @@ public class SysMessageTemplate extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String templateName;
|
private String templateName;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板内容
|
* 模板内容
|
||||||
*/
|
*/
|
||||||
private String templateContent;
|
private String templateContent;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 模板参数
|
// * 模板参数
|
||||||
*/
|
// */
|
||||||
private String templateParams;
|
// private String templateParams;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0正常 1停用)
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 备注
|
// * 备注
|
||||||
*/
|
// */
|
||||||
private String remark;
|
// private String remark;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.core.domain.model.BaseAudit;
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
import org.dromara.common.tenant.core.TenantEntity;
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
|
||||||
@ -17,7 +18,7 @@ import java.util.Date;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("sys_message_user")
|
@TableName("sys_message_user")
|
||||||
public class SysMessageUser extends BaseEntity {
|
public class SysMessageUser extends BaseAudit {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ -6,12 +6,14 @@ import jakarta.validation.constraints.NotBlank;
|
|||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.core.domain.model.BaseAudit;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
import org.dromara.system.domain.SysMessage;
|
import org.dromara.system.domain.SysMessage;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -24,7 +26,8 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class SysMessageBo extends BaseEntity {
|
@AutoMapper(target = SysMessage.class, reverseConvertGenerate = false)
|
||||||
|
public class SysMessageBo extends BaseAudit {
|
||||||
|
|
||||||
/** 主键ID */
|
/** 主键ID */
|
||||||
@ExcelProperty(value = "消息ID")
|
@ExcelProperty(value = "消息ID")
|
||||||
@ -58,22 +61,42 @@ public class SysMessageBo extends BaseEntity {
|
|||||||
@ExcelProperty(value = "定时发送时间")
|
@ExcelProperty(value = "定时发送时间")
|
||||||
private Date scheduledTime;
|
private Date scheduledTime;
|
||||||
|
|
||||||
// /** 状态(0正常 1停用) */
|
|
||||||
// @ExcelProperty(value = "状态")
|
|
||||||
// private String status;
|
|
||||||
|
|
||||||
/** 发送范围(all:全部用户, userType:按用户类型, userIds:指定用户) */
|
/** 发送范围(all:全部用户, userType:按用户类型, userIds:指定用户) */
|
||||||
|
@NotBlank(message = "发送范围不能为空", groups = { AddGroup.class })
|
||||||
private String sendScope;
|
private String sendScope;
|
||||||
|
|
||||||
/** 接收用户ID列表 */
|
/** 接收用户ID列表 */
|
||||||
private List<Long> userIds;
|
private List<Long> userIds;
|
||||||
|
|
||||||
// /** 用户类型(1普通用户 2商家 3达人 4代理) */
|
|
||||||
// private String userType;
|
|
||||||
|
|
||||||
/** 是否发送给所有用户 */
|
/** 是否发送给所有用户 */
|
||||||
private Boolean sendToAll;
|
private Boolean sendToAll;
|
||||||
|
|
||||||
|
/** 扩展数据(JSON格式) */
|
||||||
|
private String extraData;
|
||||||
|
|
||||||
|
/** 状态(0正常 1停用) */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为查询条件
|
||||||
|
*/
|
||||||
|
public LambdaQueryWrapper<SysMessage> toWrapper() {
|
||||||
|
LambdaQueryWrapper<SysMessage> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.like(StringUtils.isNotBlank(this.getTitle()), SysMessage::getTitle, this.getTitle())
|
||||||
|
.eq(StringUtils.isNotBlank(this.getMsgType()), SysMessage::getMsgType, this.getMsgType())
|
||||||
|
.eq(StringUtils.isNotBlank(this.getSubType()), SysMessage::getSubType, this.getSubType())
|
||||||
|
.eq(this.getSenderId() != null, SysMessage::getSenderId, this.getSenderId())
|
||||||
|
// .eq(StringUtils.isNotBlank(this.getStatus()), SysMessage::getStatus, this.getStatus())
|
||||||
|
.orderByDesc(SysMessage::getCreateTime);
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换为实体对象
|
||||||
|
*/
|
||||||
public SysMessage toEntity() {
|
public SysMessage toEntity() {
|
||||||
SysMessage entity = new SysMessage();
|
SysMessage entity = new SysMessage();
|
||||||
entity.setId(this.getId());
|
entity.setId(this.getId());
|
||||||
@ -83,22 +106,13 @@ public class SysMessageBo extends BaseEntity {
|
|||||||
entity.setSubType(this.getSubType());
|
entity.setSubType(this.getSubType());
|
||||||
entity.setSenderId(this.getSenderId());
|
entity.setSenderId(this.getSenderId());
|
||||||
entity.setScheduledTime(this.getScheduledTime());
|
entity.setScheduledTime(this.getScheduledTime());
|
||||||
|
// entity.setExtraData(this.getExtraData());
|
||||||
// entity.setStatus(this.getStatus());
|
// entity.setStatus(this.getStatus());
|
||||||
|
// entity.setRemark(this.getRemark());
|
||||||
entity.setCreateBy(this.getCreateBy());
|
entity.setCreateBy(this.getCreateBy());
|
||||||
entity.setCreateTime(this.getCreateTime());
|
entity.setCreateTime(this.getCreateTime());
|
||||||
entity.setUpdateBy(this.getUpdateBy());
|
entity.setUpdateBy(this.getUpdateBy());
|
||||||
entity.setUpdateTime(this.getUpdateTime());
|
entity.setUpdateTime(this.getUpdateTime());
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 转换为查询条件
|
|
||||||
*/
|
|
||||||
public LambdaQueryWrapper<SysMessage> toWrapper() {
|
|
||||||
LambdaQueryWrapper<SysMessage> lqw = new LambdaQueryWrapper<>();
|
|
||||||
lqw.like(StringUtils.isNotBlank(this.getTitle()), SysMessage::getTitle, this.getTitle())
|
|
||||||
.eq(StringUtils.isNotBlank(this.getMsgType()), SysMessage::getMsgType, this.getMsgType())
|
|
||||||
.orderByDesc(SysMessage::getCreateTime);
|
|
||||||
return lqw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
package org.dromara.system.domain.bo;
|
package org.dromara.system.domain.bo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.dromara.common.core.domain.model.BaseAudit;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
@ -12,13 +17,15 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息模板业务对象 sys_message_template
|
* 消息模板业务对象
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class SysMessageTemplateBo extends BaseEntity {
|
@AutoMapper(target = SysMessageTemplate.class, reverseConvertGenerate = false)
|
||||||
|
public class SysMessageTemplateBo extends BaseAudit {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板ID
|
* 模板ID
|
||||||
@ -27,24 +34,25 @@ public class SysMessageTemplateBo extends BaseEntity {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板类型(1通知 2公告 3消息)
|
* 模板名称
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "模板类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotBlank(message = "模板名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private String templateType;
|
@Size(max = 100, message = "模板名称长度不能超过{max}个字符")
|
||||||
|
private String templateName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板编码
|
* 模板编码
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "模板编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotBlank(message = "模板编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
@Size(min = 0, max = 64, message = "模板编码长度不能超过64个字符")
|
@Size(max = 50, message = "模板编码长度不能超过{max}个字符")
|
||||||
private String templateCode;
|
private String templateCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板名称
|
* 模板类型(SMS=短信 MAIL=邮件 WECHAT=微信 SYSTEM=系统消息)
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "模板名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotBlank(message = "模板类型不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
@Size(min = 0, max = 100, message = "模板名称长度不能超过100个字符")
|
@Size(max = 20, message = "模板类型长度不能超过{max}个字符")
|
||||||
private String templateName;
|
private String templateType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板内容
|
* 模板内容
|
||||||
@ -53,38 +61,44 @@ public class SysMessageTemplateBo extends BaseEntity {
|
|||||||
private String templateContent;
|
private String templateContent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板参数
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
private String templateParams;
|
private String status;
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
// /**
|
// /**
|
||||||
// * 状态(0正常 1停用)
|
// * 备注
|
||||||
// */
|
// */
|
||||||
// @NotBlank(message = "状态不能为空", groups = { AddGroup.class, EditGroup.class })
|
// private String remark;
|
||||||
// private String status;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 将当前对象转换为查询条件
|
||||||
*/
|
*/
|
||||||
private String remark;
|
public LambdaQueryWrapper<SysMessageTemplate> toWrapper() {
|
||||||
|
LambdaQueryWrapper<SysMessageTemplate> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.like(StringUtils.isNotBlank(templateName), SysMessageTemplate::getTemplateName, templateName)
|
||||||
|
.like(StringUtils.isNotBlank(templateCode), SysMessageTemplate::getTemplateCode, templateCode)
|
||||||
|
.eq(StringUtils.isNotBlank(templateType), SysMessageTemplate::getTemplateType, templateType)
|
||||||
|
.eq(StringUtils.isNotBlank(status), SysMessageTemplate::getStatus, status)
|
||||||
|
.orderByDesc(SysMessageTemplate::getCreateTime);
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换为实体对象
|
* 转换为实体对象
|
||||||
*/
|
*/
|
||||||
public SysMessageTemplate toEntity() {
|
public SysMessageTemplate toEntity() {
|
||||||
SysMessageTemplate entity = new SysMessageTemplate();
|
SysMessageTemplate entity = new SysMessageTemplate();
|
||||||
entity.setId(this.getId());
|
entity.setId(id);
|
||||||
entity.setTemplateType(this.getTemplateType());
|
entity.setTemplateName(templateName);
|
||||||
entity.setTemplateCode(this.getTemplateCode());
|
entity.setTemplateCode(templateCode);
|
||||||
entity.setTemplateName(this.getTemplateName());
|
entity.setTemplateType(templateType);
|
||||||
entity.setTemplateContent(this.getTemplateContent());
|
entity.setTemplateContent(templateContent);
|
||||||
entity.setTemplateParams(this.getTemplateParams());
|
entity.setStatus(status);
|
||||||
// entity.setStatus(this.getStatus());
|
entity.setTitle(title);
|
||||||
entity.setRemark(this.getRemark());
|
// entity.setRemark(remark);
|
||||||
entity.setCreateBy(this.getCreateBy());
|
|
||||||
entity.setCreateTime(this.getCreateTime());
|
|
||||||
entity.setUpdateBy(this.getUpdateBy());
|
|
||||||
entity.setUpdateTime(this.getUpdateTime());
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package org.dromara.system.domain.vo;
|
package org.dromara.system.domain.vo;
|
||||||
|
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import org.dromara.common.tenant.core.TenantEntity;
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
import org.dromara.system.domain.SysMessage;
|
||||||
|
import org.dromara.system.domain.SysMessageTemplate;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -12,7 +15,7 @@ import java.io.Serializable;
|
|||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
//@EqualsAndHashCode(callSuper = true)
|
@AutoMapper(target = SysMessageTemplate.class)
|
||||||
public class SysMessageTemplateVo implements Serializable {
|
public class SysMessageTemplateVo implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -42,18 +45,18 @@ public class SysMessageTemplateVo implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String templateContent;
|
private String templateContent;
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 模板参数
|
||||||
|
// */
|
||||||
|
// private String templateParams;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板参数
|
* 状态(0正常 1停用)
|
||||||
*/
|
*/
|
||||||
private String templateParams;
|
private String status;
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 状态(0正常 1停用)
|
// * 备注
|
||||||
// */
|
// */
|
||||||
// private String status;
|
// private String remark;
|
||||||
|
|
||||||
/**
|
|
||||||
* 备注
|
|
||||||
*/
|
|
||||||
private String remark;
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.dromara.system.service;
|
package org.dromara.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
@ -22,6 +23,16 @@ public interface ISysMessageService extends IService<SysMessage> {
|
|||||||
*/
|
*/
|
||||||
TableDataInfo<SysMessageVo> selectPageMessageList(SysMessageBo bo, PageQuery pageQuery);
|
TableDataInfo<SysMessageVo> selectPageMessageList(SysMessageBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询未读消息分页(Page方式)
|
||||||
|
*/
|
||||||
|
Page<SysMessageVo> selectUnreadMessagesPage(Long userId, Page<SysMessage> page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已读消息分页(Page方式)
|
||||||
|
*/
|
||||||
|
Page<SysMessageVo> selectReadMessagesPage(Long userId, Page<SysMessage> page);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息给指定用户
|
* 发送消息给指定用户
|
||||||
*
|
*
|
||||||
|
@ -49,6 +49,32 @@ public class SysMessageServiceImpl extends ServiceImpl<SysMessageMapper, SysMess
|
|||||||
return TableDataInfo.build(voPage);
|
return TableDataInfo.build(voPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<SysMessageVo> selectUnreadMessagesPage(Long userId, Page<SysMessage> page) {
|
||||||
|
LambdaQueryWrapper<SysMessage> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.inSql(SysMessage::getId,
|
||||||
|
"SELECT message_id FROM sys_message_user WHERE user_id = " + userId + " AND is_read = 0")
|
||||||
|
.orderByDesc(SysMessage::getCreateTime);
|
||||||
|
|
||||||
|
Page<SysMessage> messagePage = messageMapper.selectPage(page, lqw);
|
||||||
|
Page<SysMessageVo> voPage = new Page<>(messagePage.getCurrent(), messagePage.getSize(), messagePage.getTotal());
|
||||||
|
voPage.setRecords(MapstructUtils.convert(messagePage.getRecords(), SysMessageVo.class));
|
||||||
|
return voPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<SysMessageVo> selectReadMessagesPage(Long userId, Page<SysMessage> page) {
|
||||||
|
LambdaQueryWrapper<SysMessage> lqw = new LambdaQueryWrapper<>();
|
||||||
|
lqw.inSql(SysMessage::getId,
|
||||||
|
"SELECT message_id FROM sys_message_user WHERE user_id = " + userId + " AND is_read = 1")
|
||||||
|
.orderByDesc(SysMessage::getCreateTime);
|
||||||
|
|
||||||
|
Page<SysMessage> messagePage = messageMapper.selectPage(page, lqw);
|
||||||
|
Page<SysMessageVo> voPage = new Page<>(messagePage.getCurrent(), messagePage.getSize(), messagePage.getTotal());
|
||||||
|
voPage.setRecords(MapstructUtils.convert(messagePage.getRecords(), SysMessageVo.class));
|
||||||
|
return voPage;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public int sendMessageToUser(SysMessageBo message, Long userId) {
|
public int sendMessageToUser(SysMessageBo message, Long userId) {
|
||||||
|
@ -220,7 +220,7 @@ public class FlwDefinitionServiceImpl implements IFlwDefinitionService {
|
|||||||
.eq(FlowCategory::getTenantId, DEFAULT_TENANT_ID).eq(FlowCategory::getCategoryId, FlowConstant.FLOW_CATEGORY_ID));
|
.eq(FlowCategory::getTenantId, DEFAULT_TENANT_ID).eq(FlowCategory::getCategoryId, FlowConstant.FLOW_CATEGORY_ID));
|
||||||
flowCategory.setCategoryId(null);
|
flowCategory.setCategoryId(null);
|
||||||
flowCategory.setTenantId(tenantId);
|
flowCategory.setTenantId(tenantId);
|
||||||
// flowCategory.setCreateDept(null);
|
flowCategory.setCreateDept(null);
|
||||||
flowCategory.setCreateBy(null);
|
flowCategory.setCreateBy(null);
|
||||||
flowCategory.setCreateTime(null);
|
flowCategory.setCreateTime(null);
|
||||||
flowCategory.setUpdateBy(null);
|
flowCategory.setUpdateBy(null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user