wip: 通知公告开发
通知公告开发
This commit is contained in:
@@ -25,7 +25,7 @@ public class PageResult<T> implements Serializable {
|
|||||||
PageResult<T> result = new PageResult<>();
|
PageResult<T> result = new PageResult<>();
|
||||||
result.setCode(ResultCode.SUCCESS.getCode());
|
result.setCode(ResultCode.SUCCESS.getCode());
|
||||||
|
|
||||||
Data data = new Data<T>();
|
Data<T> data = new Data<>();
|
||||||
data.setList(page.getRecords());
|
data.setList(page.getRecords());
|
||||||
data.setTotal(page.getTotal());
|
data.setTotal(page.getTotal());
|
||||||
|
|
||||||
|
|||||||
@@ -78,21 +78,6 @@ public class SysUserDetails implements UserDetails {
|
|||||||
return this.username;
|
return this.username;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAccountNonExpired() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAccountNonLocked() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCredentialsNonExpired() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return this.enabled;
|
return this.enabled;
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
package com.youlai.boot.platform.websocket.service.impl;
|
package com.youlai.boot.platform.websocket.service.impl;
|
||||||
|
|
||||||
import com.youlai.system.event.UserConnectionEvent;
|
import com.youlai.boot.platform.websocket.service.WebsocketService;
|
||||||
import com.youlai.system.model.dto.ChatMessage;
|
import com.youlai.boot.system.event.UserConnectionEvent;
|
||||||
import com.youlai.system.service.WebsocketService;
|
import com.youlai.boot.system.model.dto.ChatMessage;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
import org.springframework.messaging.simp.SimpMessagingTemplate;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.socket.messaging.SessionDisconnectEvent;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@@ -22,14 +20,8 @@ public class WebsocketServiceImpl implements WebsocketService {
|
|||||||
|
|
||||||
private final SimpMessagingTemplate messagingTemplate;
|
private final SimpMessagingTemplate messagingTemplate;
|
||||||
|
|
||||||
// 在线用户
|
|
||||||
private final Set<String> onlineUsers = ConcurrentHashMap.newKeySet();
|
private final Set<String> onlineUsers = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// 离线消息
|
|
||||||
private final Set<ChatMessage> offlineMessages = ConcurrentHashMap.newKeySet();
|
|
||||||
|
|
||||||
private final Map<ChatMessage,Set<String>> messageReceiptStatus = new ConcurrentHashMap<>();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addUser(String username) {
|
public void addUser(String username) {
|
||||||
onlineUsers.add(username);
|
onlineUsers.add(username);
|
||||||
@@ -51,11 +43,6 @@ public class WebsocketServiceImpl implements WebsocketService {
|
|||||||
if (event.isConnected()) {
|
if (event.isConnected()) {
|
||||||
onlineUsers.add(username);
|
onlineUsers.add(username);
|
||||||
log.info("User connected: {}", username);
|
log.info("User connected: {}", username);
|
||||||
// 发送离线消息
|
|
||||||
offlineMessages.forEach(message -> {
|
|
||||||
messagingTemplate.convertAndSendToUser(username, "/topic/chat", message);
|
|
||||||
messageReceiptStatus.computeIfAbsent(message, k -> ConcurrentHashMap.newKeySet()).add(username);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
onlineUsers.remove(username);
|
onlineUsers.remove(username);
|
||||||
log.info("User disconnected: {}", username);
|
log.info("User disconnected: {}", username);
|
||||||
@@ -64,12 +51,6 @@ public class WebsocketServiceImpl implements WebsocketService {
|
|||||||
messagingTemplate.convertAndSend("/topic/onlineUserCount", onlineUsers.size());
|
messagingTemplate.convertAndSend("/topic/onlineUserCount", onlineUsers.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener
|
|
||||||
public void handleSessionDisconnect(SessionDisconnectEvent event) {
|
|
||||||
String username = event.getUser().getName();
|
|
||||||
onlineUsers.remove(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Scheduled(fixedRate = 5000)
|
@Scheduled(fixedRate = 5000)
|
||||||
public void sendOnlineUserCount() {
|
public void sendOnlineUserCount() {
|
||||||
messagingTemplate.convertAndSend("/topic/onlineUserCount", onlineUsers.size());
|
messagingTemplate.convertAndSend("/topic/onlineUserCount", onlineUsers.size());
|
||||||
@@ -78,17 +59,8 @@ public class WebsocketServiceImpl implements WebsocketService {
|
|||||||
@Override
|
@Override
|
||||||
public void sendStringToFrontend(String sender, String message) {
|
public void sendStringToFrontend(String sender, String message) {
|
||||||
ChatMessage chatMessage = new ChatMessage(sender, message);
|
ChatMessage chatMessage = new ChatMessage(sender, message);
|
||||||
offlineMessages.add(chatMessage);
|
|
||||||
messageReceiptStatus.putIfAbsent(chatMessage, ConcurrentHashMap.newKeySet());
|
|
||||||
onlineUsers.forEach(receiver -> {
|
onlineUsers.forEach(receiver -> {
|
||||||
messagingTemplate.convertAndSendToUser(receiver, "/topic/chat", chatMessage);
|
messagingTemplate.convertAndSendToUser(receiver, "/topic/chat", chatMessage);
|
||||||
messageReceiptStatus.get(chatMessage).add(receiver);
|
|
||||||
});
|
});
|
||||||
if(messageReceiptStatus.get(chatMessage).size() == onlineUsers.size()) {
|
|
||||||
//记录完成状态
|
|
||||||
offlineMessages.remove(chatMessage);//从离线消息中移除已发送的消息
|
|
||||||
messageReceiptStatus.remove(chatMessage);//从消息接收状态集合总移除已发送的消息
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,20 @@
|
|||||||
package com.youlai.system.controller;
|
package com.youlai.boot.system.controller;
|
||||||
|
|
||||||
import com.youlai.system.service.NoticeService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.youlai.system.model.form.NoticeForm;
|
|
||||||
import com.youlai.system.model.query.NoticeQuery;
|
|
||||||
import com.youlai.system.model.vo.NoticeVO;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.youlai.system.common.result.PageResult;
|
import com.youlai.boot.common.result.PageResult;
|
||||||
import com.youlai.system.common.result.Result;
|
import com.youlai.boot.common.result.Result;
|
||||||
|
import com.youlai.boot.system.model.form.NoticeForm;
|
||||||
|
import com.youlai.boot.system.model.query.NoticeQuery;
|
||||||
|
import com.youlai.boot.system.model.vo.NoticeVO;
|
||||||
|
import com.youlai.boot.system.service.NoticeService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告前端控制层
|
* 通知公告前端控制层
|
||||||
@@ -43,7 +41,7 @@ public class NoticeController {
|
|||||||
@Operation(summary = "新增通知公告")
|
@Operation(summary = "新增通知公告")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@PreAuthorize("@ss.hasPerm('system:notice:add')")
|
@PreAuthorize("@ss.hasPerm('system:notice:add')")
|
||||||
public Result saveNotice(@RequestBody @Valid NoticeForm formData ) {
|
public Result<?> saveNotice(@RequestBody @Valid NoticeForm formData ) {
|
||||||
boolean result = noticeService.saveNotice(formData);
|
boolean result = noticeService.saveNotice(formData);
|
||||||
return Result.judge(result);
|
return Result.judge(result);
|
||||||
}
|
}
|
||||||
@@ -61,7 +59,7 @@ public class NoticeController {
|
|||||||
@Operation(summary = "修改通知公告")
|
@Operation(summary = "修改通知公告")
|
||||||
@PutMapping(value = "/{id}")
|
@PutMapping(value = "/{id}")
|
||||||
@PreAuthorize("@ss.hasPerm('system:notice:edit')")
|
@PreAuthorize("@ss.hasPerm('system:notice:edit')")
|
||||||
public Result updateNotice(
|
public Result<?> updateNotice(
|
||||||
@Parameter(description = "通知公告ID") @PathVariable Long id,
|
@Parameter(description = "通知公告ID") @PathVariable Long id,
|
||||||
@RequestBody @Validated NoticeForm formData
|
@RequestBody @Validated NoticeForm formData
|
||||||
) {
|
) {
|
||||||
@@ -69,10 +67,26 @@ public class NoticeController {
|
|||||||
return Result.judge(result);
|
return Result.judge(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "发布通知公告")
|
||||||
|
@PatchMapping(value = "/release/{id}")
|
||||||
|
@PreAuthorize("@ss.hasPerm('system:notice:release')")
|
||||||
|
public Result<?> releaseNotice(@Parameter(description = "通知公告ID") @PathVariable Long id) {
|
||||||
|
boolean result = noticeService.releaseNotice(id);
|
||||||
|
return Result.judge(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "撤回通知公告")
|
||||||
|
@PatchMapping(value = "/recall/{id}")
|
||||||
|
@PreAuthorize("@ss.hasPerm('system:notice:recall')")
|
||||||
|
public Result<?> recallNotice(@Parameter(description = "通知公告ID") @PathVariable Long id) {
|
||||||
|
boolean result = noticeService.recallNotice(id);
|
||||||
|
return Result.judge(result);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除通知公告")
|
@Operation(summary = "删除通知公告")
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
@PreAuthorize("@ss.hasPerm('system:notice:delete')")
|
@PreAuthorize("@ss.hasPerm('system:notice:delete')")
|
||||||
public Result deleteNotices(
|
public Result<?> deleteNotices(
|
||||||
@Parameter(description = "通知公告ID,多个以英文逗号(,)分割") @PathVariable String ids
|
@Parameter(description = "通知公告ID,多个以英文逗号(,)分割") @PathVariable String ids
|
||||||
) {
|
) {
|
||||||
boolean result = noticeService.deleteNotices(ids);
|
boolean result = noticeService.deleteNotices(ids);
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
package com.youlai.system.controller;
|
|
||||||
|
|
||||||
import com.youlai.system.service.NoticeStatusService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.youlai.system.model.form.NoticeStatusForm;
|
|
||||||
import com.youlai.system.model.query.NoticeStatusQuery;
|
|
||||||
import com.youlai.system.model.vo.NoticeStatusVO;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.youlai.system.common.result.PageResult;
|
|
||||||
import com.youlai.system.common.result.Result;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户公告状态前端控制层
|
|
||||||
*
|
|
||||||
* @author youlaitech
|
|
||||||
* @since 2024-08-28 16:56
|
|
||||||
*/
|
|
||||||
@Tag(name = "用户公告状态接口")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/v1/noticeStatuss")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class NoticeStatusController {
|
|
||||||
|
|
||||||
private final NoticeStatusService noticeStatusService;
|
|
||||||
|
|
||||||
@Operation(summary = "用户公告状态分页列表")
|
|
||||||
@GetMapping("/page")
|
|
||||||
@PreAuthorize("@ss.hasPerm('system:noticeStatus:query')")
|
|
||||||
public PageResult<NoticeStatusVO> getNoticeStatusPage(NoticeStatusQuery queryParams ) {
|
|
||||||
IPage<NoticeStatusVO> result = noticeStatusService.getNoticeStatusPage(queryParams);
|
|
||||||
return PageResult.success(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "新增用户公告状态")
|
|
||||||
@PostMapping
|
|
||||||
@PreAuthorize("@ss.hasPerm('system:noticeStatus:add')")
|
|
||||||
public Result saveNoticeStatus(@RequestBody @Valid NoticeStatusForm formData ) {
|
|
||||||
boolean result = noticeStatusService.saveNoticeStatus(formData);
|
|
||||||
return Result.judge(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "获取用户公告状态表单数据")
|
|
||||||
@GetMapping("/{id}/form")
|
|
||||||
@PreAuthorize("@ss.hasPerm('system:noticeStatus:edit')")
|
|
||||||
public Result<NoticeStatusForm> getNoticeStatusForm(
|
|
||||||
@Parameter(description = "用户公告状态ID") @PathVariable Long id
|
|
||||||
) {
|
|
||||||
NoticeStatusForm formData = noticeStatusService.getNoticeStatusFormData(id);
|
|
||||||
return Result.success(formData);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "修改用户公告状态")
|
|
||||||
@PutMapping(value = "/{id}")
|
|
||||||
@PreAuthorize("@ss.hasPerm('system:noticeStatus:edit')")
|
|
||||||
public Result updateNoticeStatus(
|
|
||||||
@Parameter(description = "用户公告状态ID") @PathVariable Long id,
|
|
||||||
@RequestBody @Validated NoticeStatusForm formData
|
|
||||||
) {
|
|
||||||
boolean result = noticeStatusService.updateNoticeStatus(id, formData);
|
|
||||||
return Result.judge(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "删除用户公告状态")
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
@PreAuthorize("@ss.hasPerm('system:noticeStatus:delete')")
|
|
||||||
public Result deleteNoticeStatuss(
|
|
||||||
@Parameter(description = "用户公告状态ID,多个以英文逗号(,)分割") @PathVariable String ids
|
|
||||||
) {
|
|
||||||
boolean result = noticeStatusService.deleteNoticeStatuss(ids);
|
|
||||||
return Result.judge(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.youlai.system.converter;
|
package com.youlai.boot.system.converter;
|
||||||
|
|
||||||
import com.youlai.system.model.vo.NoticeVO;
|
import com.youlai.boot.system.model.entity.Notice;
|
||||||
|
import com.youlai.boot.system.model.form.NoticeForm;
|
||||||
|
import com.youlai.boot.system.model.vo.NoticeVO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.youlai.system.model.entity.Notice;
|
|
||||||
import com.youlai.system.model.form.NoticeForm;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告对象转换器
|
* 通知公告对象转换器
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.youlai.system.converter;
|
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.youlai.system.model.entity.NoticeStatus;
|
|
||||||
import com.youlai.system.model.form.NoticeStatusForm;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户公告状态对象转换器
|
|
||||||
*
|
|
||||||
* @author youlaitech
|
|
||||||
* @since 2024-08-28 16:56
|
|
||||||
*/
|
|
||||||
@Mapper(componentModel = "spring")
|
|
||||||
public interface NoticeStatusConverter{
|
|
||||||
|
|
||||||
NoticeStatusForm toForm(NoticeStatus entity);
|
|
||||||
|
|
||||||
NoticeStatus toEntity(NoticeStatusForm formData);
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.youlai.system.mapper;
|
package com.youlai.boot.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.youlai.system.model.entity.Notice;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.youlai.system.model.query.NoticeQuery;
|
import com.youlai.boot.system.model.entity.Notice;
|
||||||
import com.youlai.system.model.vo.NoticeVO;
|
import com.youlai.boot.system.model.query.NoticeQuery;
|
||||||
|
import com.youlai.boot.system.model.vo.NoticeVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告Mapper接口
|
* 通知公告Mapper接口
|
||||||
@@ -21,8 +22,8 @@ public interface NoticeMapper extends BaseMapper<Notice> {
|
|||||||
*
|
*
|
||||||
* @param page 分页对象
|
* @param page 分页对象
|
||||||
* @param queryParams 查询参数
|
* @param queryParams 查询参数
|
||||||
* @return
|
* @return 通知公告分页数据
|
||||||
*/
|
*/
|
||||||
Page<NoticeVO> getNoticePage(Page<NoticeVO> page, NoticeQuery queryParams);
|
Page<NoticeVO> getNoticePage(Page<NoticeVO> page, @Param("queryParams") NoticeQuery queryParams);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
package com.youlai.system.mapper;
|
package com.youlai.boot.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.youlai.system.model.entity.NoticeStatus;
|
import com.youlai.boot.system.model.entity.NoticeStatus;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.youlai.system.model.query.NoticeStatusQuery;
|
|
||||||
import com.youlai.system.model.vo.NoticeStatusVO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,13 +13,4 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface NoticeStatusMapper extends BaseMapper<NoticeStatus> {
|
public interface NoticeStatusMapper extends BaseMapper<NoticeStatus> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户公告状态分页数据
|
|
||||||
*
|
|
||||||
* @param page 分页对象
|
|
||||||
* @param queryParams 查询参数
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Page<NoticeStatusVO> getNoticeStatusPage(Page<NoticeStatusVO> page, NoticeStatusQuery queryParams);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.*;
|
|||||||
import com.youlai.boot.common.base.BaseEntity;
|
import com.youlai.boot.common.base.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统配置 实体
|
* 系统配置 实体
|
||||||
@@ -11,9 +12,10 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
* @author Theo
|
* @author Theo
|
||||||
* @since 2024-07-29 11:17:26
|
* @since 2024-07-29 11:17:26
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Schema(description = "系统配置")
|
@Schema(description = "系统配置")
|
||||||
@TableName("sys_config")
|
@TableName("sys_config")
|
||||||
@Data
|
|
||||||
public class Config extends BaseEntity {
|
public class Config extends BaseEntity {
|
||||||
|
|
||||||
@Schema(description = "配置名称")
|
@Schema(description = "配置名称")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.youlai.boot.system.model.entity;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.youlai.boot.common.base.BaseEntity;
|
import com.youlai.boot.common.base.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典实体
|
* 字典实体
|
||||||
@@ -10,8 +11,9 @@ import lombok.Data;
|
|||||||
* @author haoxr
|
* @author haoxr
|
||||||
* @since 2022/12/17
|
* @since 2022/12/17
|
||||||
*/
|
*/
|
||||||
@TableName("sys_dict")
|
|
||||||
@Data
|
@Data
|
||||||
|
@TableName("sys_dict")
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class Dict extends BaseEntity {
|
public class Dict extends BaseEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.youlai.system.model.entity;
|
package com.youlai.boot.system.model.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.youlai.boot.common.base.BaseEntity;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.youlai.system.common.base.BaseEntity;
|
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
/**
|
/**
|
||||||
* 通知公告实体对象
|
* 通知公告实体对象
|
||||||
*
|
*
|
||||||
@@ -44,15 +47,19 @@ public class Notice extends BaseEntity {
|
|||||||
* 目标类型(0-全体 1-指定)
|
* 目标类型(0-全体 1-指定)
|
||||||
*/
|
*/
|
||||||
private Integer tarType;
|
private Integer tarType;
|
||||||
|
/**
|
||||||
|
* 目标ID
|
||||||
|
*/
|
||||||
|
private String tarIds;
|
||||||
/**
|
/**
|
||||||
* 发布状态(0-未发布 1已发布 2已撤回)
|
* 发布状态(0-未发布 1已发布 2已撤回)
|
||||||
*/
|
*/
|
||||||
private Integer sendStatus;
|
private Integer releaseStatus;
|
||||||
/**
|
/**
|
||||||
* 发布时间
|
* 发布时间
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime sendTime;
|
private LocalDateTime releaseTime;
|
||||||
/**
|
/**
|
||||||
* 撤回时间
|
* 撤回时间
|
||||||
*/
|
*/
|
||||||
@@ -61,13 +68,16 @@ public class Notice extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 创建人ID
|
* 创建人ID
|
||||||
*/
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Long createBy;
|
private Long createBy;
|
||||||
/**
|
/**
|
||||||
* 更新人ID
|
* 更新人ID
|
||||||
*/
|
*/
|
||||||
|
@TableField(fill = FieldFill.UPDATE)
|
||||||
private Long updateBy;
|
private Long updateBy;
|
||||||
/**
|
/**
|
||||||
* 逻辑删除标识(0-未删除 1-已删除)
|
* 逻辑删除标识(0-未删除 1-已删除)
|
||||||
*/
|
*/
|
||||||
private Integer isDelete;
|
@TableLogic(value = "0", delval = "1")
|
||||||
|
private Integer isDeleted;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.youlai.system.model.entity;
|
package com.youlai.boot.system.model.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.youlai.system.common.base.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户公告状态实体对象
|
* 用户公告状态实体对象
|
||||||
@@ -38,11 +37,11 @@ public class NoticeStatus implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long userId;
|
private Long userId;
|
||||||
/**
|
/**
|
||||||
* 读取状态,0未读,1已读取
|
* 读取状态,0未读,1已读
|
||||||
*/
|
*/
|
||||||
private Long readStatus;
|
private Integer readStatus;
|
||||||
/**
|
/**
|
||||||
* 用户阅读时间
|
* 用户阅读时间
|
||||||
*/
|
*/
|
||||||
private LocalDateTime readTiem;
|
private LocalDateTime readTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package com.youlai.system.model.form;
|
package com.youlai.boot.system.model.form;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.validator.constraints.Range;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表单对象
|
* 通知公告表单对象
|
||||||
@@ -24,6 +25,7 @@ public class NoticeForm implements Serializable {
|
|||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "通知ID")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "通知标题")
|
@Schema(description = "通知标题")
|
||||||
@@ -39,28 +41,15 @@ public class NoticeForm implements Serializable {
|
|||||||
@Schema(description = "通知类型")
|
@Schema(description = "通知类型")
|
||||||
private Integer noticeType;
|
private Integer noticeType;
|
||||||
|
|
||||||
@Schema(description = "发布人")
|
|
||||||
@NotNull(message = "发布人不能为空")
|
|
||||||
private Long releaseBy;
|
|
||||||
|
|
||||||
@Schema(description = "优先级(0-低 1-中 2-高)")
|
@Schema(description = "优先级(0-低 1-中 2-高)")
|
||||||
|
@Range(min = 0, max = 2, message = "优先级取值范围[0,2]")
|
||||||
private Integer priority;
|
private Integer priority;
|
||||||
|
|
||||||
@Schema(description = "目标类型(0-全体 1-指定)")
|
@Schema(description = "目标类型(0-全体 1-指定)")
|
||||||
|
@Range(min = 0, max = 1, message = "目标类型取值范围[0,1]")
|
||||||
private Integer tarType;
|
private Integer tarType;
|
||||||
|
|
||||||
@Schema(description = "发布状态(0-未发布 1已发布 2已撤回)")
|
@Schema(description = "接收人ID集合")
|
||||||
private Integer sendStatus;
|
private List<String> userIds;
|
||||||
|
|
||||||
@Schema(description = "发布时间")
|
|
||||||
@NotNull(message = "发布时间不能为空")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime sendTime;
|
|
||||||
|
|
||||||
@Schema(description = "撤回时间")
|
|
||||||
@NotNull(message = "撤回时间不能为空")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime recallTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ package com.youlai.boot.system.model.query;
|
|||||||
import com.youlai.boot.common.base.BasePageQuery;
|
import com.youlai.boot.common.base.BasePageQuery;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@Schema(description ="字典数据项分页查询对象")
|
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Schema(description ="字典数据项分页查询对象")
|
||||||
public class DictPageQuery extends BasePageQuery {
|
public class DictPageQuery extends BasePageQuery {
|
||||||
|
|
||||||
@Schema(description="关键字(字典项名称)")
|
@Schema(description="关键字(字典项名称)")
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.youlai.system.model.query;
|
package com.youlai.boot.system.model.query;
|
||||||
|
|
||||||
import com.youlai.system.common.base.BasePageQuery;
|
import com.youlai.boot.common.base.BasePageQuery;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Getter;
|
import lombok.Data;
|
||||||
import lombok.Setter;
|
import lombok.EqualsAndHashCode;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,29 +13,19 @@ import java.util.List;
|
|||||||
* @author youlaitech
|
* @author youlaitech
|
||||||
* @since 2024-08-27 10:31
|
* @since 2024-08-27 10:31
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Schema(description ="通知公告查询对象")
|
@Schema(description ="通知公告查询对象")
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
public class NoticeQuery extends BasePageQuery {
|
public class NoticeQuery extends BasePageQuery {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "通知标题")
|
@Schema(description = "通知标题")
|
||||||
private String title;
|
private String title;
|
||||||
@Schema(description = "通知内容")
|
|
||||||
private String content;
|
|
||||||
@Schema(description = "通知类型")
|
|
||||||
private Integer noticeType;
|
|
||||||
@Schema(description = "发布人")
|
|
||||||
private Long releaseBy;
|
|
||||||
@Schema(description = "优先级(0-低 1-中 2-高)")
|
|
||||||
private Integer priority;
|
|
||||||
@Schema(description = "目标类型(0-全体 1-指定)")
|
|
||||||
private Integer tarType;
|
|
||||||
@Schema(description = "发布状态(0-未发布 1已发布 2已撤回)")
|
@Schema(description = "发布状态(0-未发布 1已发布 2已撤回)")
|
||||||
private Integer sendStatus;
|
private Integer releaseStatus;
|
||||||
|
|
||||||
@Schema(description = "发布时间")
|
@Schema(description = "发布时间")
|
||||||
private List<String> sendTime;
|
private List<String> releaseTime;
|
||||||
@Schema(description = "撤回时间")
|
|
||||||
private List<String> recallTime;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.youlai.system.model.query;
|
package com.youlai.boot.system.model.query;
|
||||||
|
|
||||||
import com.youlai.system.common.base.BasePageQuery;
|
import com.youlai.boot.common.base.BasePageQuery;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,12 +21,16 @@ public class NoticeStatusQuery extends BasePageQuery {
|
|||||||
|
|
||||||
@Schema(description = "id")
|
@Schema(description = "id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "公共通知id")
|
@Schema(description = "公共通知id")
|
||||||
private Long noticeId;
|
private Long noticeId;
|
||||||
|
|
||||||
@Schema(description = "用户id")
|
@Schema(description = "用户id")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
@Schema(description = "读取状态,0未读,1已读取")
|
@Schema(description = "读取状态,0未读,1已读取")
|
||||||
private Long readStatus;
|
private Long readStatus;
|
||||||
|
|
||||||
@Schema(description = "用户阅读时间")
|
@Schema(description = "用户阅读时间")
|
||||||
private List<String> readTiem;
|
private List<String> readTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.youlai.boot.system.model.query;
|
|||||||
import com.youlai.boot.common.base.BasePageQuery;
|
import com.youlai.boot.common.base.BasePageQuery;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 权限分页查询对象
|
* 权限分页查询对象
|
||||||
@@ -11,7 +12,8 @@ import lombok.Data;
|
|||||||
* @since 2022/1/14 22:22
|
* @since 2022/1/14 22:22
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema
|
@Schema
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class PermPageQuery extends BasePageQuery {
|
public class PermPageQuery extends BasePageQuery {
|
||||||
|
|
||||||
@Schema(description="权限名称")
|
@Schema(description="权限名称")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.youlai.boot.system.model.query;
|
|||||||
import com.youlai.boot.common.base.BasePageQuery;
|
import com.youlai.boot.common.base.BasePageQuery;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -12,8 +13,9 @@ import java.util.List;
|
|||||||
* @author haoxr
|
* @author haoxr
|
||||||
* @since 2022/1/14
|
* @since 2022/1/14
|
||||||
*/
|
*/
|
||||||
@Schema(description ="用户分页查询对象")
|
|
||||||
@Data
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Schema(description ="用户分页查询对象")
|
||||||
public class UserPageQuery extends BasePageQuery {
|
public class UserPageQuery extends BasePageQuery {
|
||||||
|
|
||||||
@Schema(description="关键字(用户名/昵称/手机号)")
|
@Schema(description="关键字(用户名/昵称/手机号)")
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.youlai.system.model.vo;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户公告状态视图对象
|
|
||||||
*
|
|
||||||
* @author youlaitech
|
|
||||||
* @since 2024-08-28 16:56
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Schema( description = "用户公告状态视图对象")
|
|
||||||
public class NoticeStatusVO implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Schema(description = "id")
|
|
||||||
private Long id;
|
|
||||||
@Schema(description = "公共通知id")
|
|
||||||
private Long noticeId;
|
|
||||||
@Schema(description = "用户id")
|
|
||||||
private Integer userId;
|
|
||||||
@Schema(description = "读取状态,0未读,1已读取")
|
|
||||||
private Long readStatus;
|
|
||||||
@Schema(description = "用户阅读时间")
|
|
||||||
private LocalDateTime readTiem;
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.youlai.system.model.vo;
|
package com.youlai.boot.system.model.vo;
|
||||||
|
|
||||||
import java.io.Serial;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,24 +26,23 @@ public class NoticeVO implements Serializable {
|
|||||||
private Long id;
|
private Long id;
|
||||||
@Schema(description = "通知标题")
|
@Schema(description = "通知标题")
|
||||||
private String title;
|
private String title;
|
||||||
@Schema(description = "通知内容")
|
|
||||||
private String content;
|
|
||||||
@Schema(description = "通知类型")
|
@Schema(description = "通知类型")
|
||||||
private Integer noticeType;
|
private Integer noticeType;
|
||||||
|
|
||||||
@Schema(description = "发布人")
|
@Schema(description = "发布人")
|
||||||
private Long releaseBy;
|
private String releaseBy;
|
||||||
|
|
||||||
@Schema(description = "优先级(0-低 1-中 2-高)")
|
@Schema(description = "优先级(0-低 1-中 2-高)")
|
||||||
private Integer priority;
|
private Integer priority;
|
||||||
|
|
||||||
@Schema(description = "目标类型(0-全体 1-指定)")
|
@Schema(description = "目标类型(0-全体 1-指定)")
|
||||||
private Integer tarType;
|
private Integer tarType;
|
||||||
|
|
||||||
@Schema(description = "发布状态(0-未发布 1已发布 2已撤回)")
|
@Schema(description = "发布状态(0-未发布 1已发布 2已撤回)")
|
||||||
private Integer sendStatus;
|
private Integer releaseStatus;
|
||||||
|
|
||||||
@Schema(description = "发布时间")
|
@Schema(description = "发布时间")
|
||||||
private LocalDateTime sendTime;
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Schema(description = "撤回时间")
|
private LocalDateTime releaseTime;
|
||||||
private LocalDateTime recallTime;
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
@Schema(description = "更新时间")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.youlai.system.service;
|
package com.youlai.boot.system.service;
|
||||||
|
|
||||||
import com.youlai.system.model.entity.Notice;
|
|
||||||
import com.youlai.system.model.form.NoticeForm;
|
|
||||||
import com.youlai.system.model.query.NoticeQuery;
|
|
||||||
import com.youlai.system.model.vo.NoticeVO;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.youlai.boot.system.model.entity.Notice;
|
||||||
|
import com.youlai.boot.system.model.form.NoticeForm;
|
||||||
|
import com.youlai.boot.system.model.query.NoticeQuery;
|
||||||
|
import com.youlai.boot.system.model.vo.NoticeVO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告服务类
|
* 通知公告服务类
|
||||||
@@ -18,7 +18,7 @@ public interface NoticeService extends IService<Notice> {
|
|||||||
/**
|
/**
|
||||||
*通知公告分页列表
|
*通知公告分页列表
|
||||||
*
|
*
|
||||||
* @return
|
* @return 通知公告分页列表
|
||||||
*/
|
*/
|
||||||
IPage<NoticeVO> getNoticePage(NoticeQuery queryParams);
|
IPage<NoticeVO> getNoticePage(NoticeQuery queryParams);
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ public interface NoticeService extends IService<Notice> {
|
|||||||
* 获取通知公告表单数据
|
* 获取通知公告表单数据
|
||||||
*
|
*
|
||||||
* @param id 通知公告ID
|
* @param id 通知公告ID
|
||||||
* @return
|
* @return 通知公告表单对象
|
||||||
*/
|
*/
|
||||||
NoticeForm getNoticeFormData(Long id);
|
NoticeForm getNoticeFormData(Long id);
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public interface NoticeService extends IService<Notice> {
|
|||||||
* 新增通知公告
|
* 新增通知公告
|
||||||
*
|
*
|
||||||
* @param formData 通知公告表单对象
|
* @param formData 通知公告表单对象
|
||||||
* @return
|
* @return 是否新增成功
|
||||||
*/
|
*/
|
||||||
boolean saveNotice(NoticeForm formData);
|
boolean saveNotice(NoticeForm formData);
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public interface NoticeService extends IService<Notice> {
|
|||||||
*
|
*
|
||||||
* @param id 通知公告ID
|
* @param id 通知公告ID
|
||||||
* @param formData 通知公告表单对象
|
* @param formData 通知公告表单对象
|
||||||
* @return
|
* @return 是否修改成功
|
||||||
*/
|
*/
|
||||||
boolean updateNotice(Long id, NoticeForm formData);
|
boolean updateNotice(Long id, NoticeForm formData);
|
||||||
|
|
||||||
@@ -51,8 +51,23 @@ public interface NoticeService extends IService<Notice> {
|
|||||||
* 删除通知公告
|
* 删除通知公告
|
||||||
*
|
*
|
||||||
* @param ids 通知公告ID,多个以英文逗号(,)分割
|
* @param ids 通知公告ID,多个以英文逗号(,)分割
|
||||||
* @return
|
* @return 是否删除成功
|
||||||
*/
|
*/
|
||||||
boolean deleteNotices(String ids);
|
boolean deleteNotices(String ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布通知公告
|
||||||
|
*
|
||||||
|
* @param id 通知公告ID
|
||||||
|
* @return 是否发布成功
|
||||||
|
*/
|
||||||
|
boolean releaseNotice(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回通知公告
|
||||||
|
*
|
||||||
|
* @param id 通知公告ID
|
||||||
|
* @return 是否撤回成功
|
||||||
|
*/
|
||||||
|
boolean recallNotice(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
package com.youlai.system.service;
|
package com.youlai.boot.system.service;
|
||||||
|
|
||||||
import com.youlai.system.model.entity.NoticeStatus;
|
|
||||||
import com.youlai.system.model.form.NoticeStatusForm;
|
|
||||||
import com.youlai.system.model.query.NoticeStatusQuery;
|
|
||||||
import com.youlai.system.model.vo.NoticeStatusVO;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.youlai.boot.system.model.entity.NoticeStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户公告状态服务类
|
* 用户公告状态服务类
|
||||||
@@ -15,44 +11,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
*/
|
*/
|
||||||
public interface NoticeStatusService extends IService<NoticeStatus> {
|
public interface NoticeStatusService extends IService<NoticeStatus> {
|
||||||
|
|
||||||
/**
|
|
||||||
*用户公告状态分页列表
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
IPage<NoticeStatusVO> getNoticeStatusPage(NoticeStatusQuery queryParams);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户公告状态表单数据
|
|
||||||
*
|
|
||||||
* @param id 用户公告状态ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
NoticeStatusForm getNoticeStatusFormData(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增用户公告状态
|
|
||||||
*
|
|
||||||
* @param formData 用户公告状态表单对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean saveNoticeStatus(NoticeStatusForm formData);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改用户公告状态
|
|
||||||
*
|
|
||||||
* @param id 用户公告状态ID
|
|
||||||
* @param formData 用户公告状态表单对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean updateNoticeStatus(Long id, NoticeStatusForm formData);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除用户公告状态
|
|
||||||
*
|
|
||||||
* @param ids 用户公告状态ID,多个以英文逗号(,)分割
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
boolean deleteNoticeStatuss(String ids);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,34 @@
|
|||||||
package com.youlai.system.service.impl;
|
package com.youlai.boot.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
||||||
import com.google.gson.*;
|
|
||||||
import com.youlai.system.model.entity.NoticeStatus;
|
|
||||||
import com.youlai.system.model.entity.SysUser;
|
|
||||||
import com.youlai.system.security.util.SecurityUtils;
|
|
||||||
import com.youlai.system.service.NoticeStatusService;
|
|
||||||
import com.youlai.system.service.SysUserService;
|
|
||||||
import com.youlai.system.service.WebsocketService;
|
|
||||||
import jodd.util.StringUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.youlai.system.mapper.NoticeMapper;
|
import com.google.gson.*;
|
||||||
import com.youlai.system.service.NoticeService;
|
import com.youlai.boot.common.constant.SymbolConstant;
|
||||||
import com.youlai.system.model.entity.Notice;
|
import com.youlai.boot.core.security.util.SecurityUtils;
|
||||||
import com.youlai.system.model.form.NoticeForm;
|
import com.youlai.boot.platform.websocket.service.WebsocketService;
|
||||||
import com.youlai.system.model.query.NoticeQuery;
|
import com.youlai.boot.system.converter.NoticeConverter;
|
||||||
import com.youlai.system.model.vo.NoticeVO;
|
import com.youlai.boot.system.mapper.NoticeMapper;
|
||||||
import com.youlai.system.converter.NoticeConverter;
|
import com.youlai.boot.system.model.entity.Notice;
|
||||||
|
import com.youlai.boot.system.model.entity.NoticeStatus;
|
||||||
|
import com.youlai.boot.system.model.entity.User;
|
||||||
|
import com.youlai.boot.system.model.form.NoticeForm;
|
||||||
|
import com.youlai.boot.system.model.query.NoticeQuery;
|
||||||
|
import com.youlai.boot.system.model.vo.NoticeVO;
|
||||||
|
import com.youlai.boot.system.service.NoticeService;
|
||||||
|
import com.youlai.boot.system.service.NoticeStatusService;
|
||||||
|
import com.youlai.boot.system.service.UserService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告服务实现类
|
* 通知公告服务实现类
|
||||||
@@ -44,11 +42,11 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
|
|
||||||
private final NoticeConverter noticeConverter;
|
private final NoticeConverter noticeConverter;
|
||||||
|
|
||||||
private final WebsocketService webSocketServer;
|
private final WebsocketService websocketService;
|
||||||
|
|
||||||
private final NoticeStatusService noticeStatusService;
|
private final NoticeStatusService noticeStatusService;
|
||||||
|
|
||||||
private final SysUserService sysUserService;
|
private final UserService userService;
|
||||||
|
|
||||||
private final Gson gson = new GsonBuilder()
|
private final Gson gson = new GsonBuilder()
|
||||||
.registerTypeAdapter(LocalDateTime.class, (JsonSerializer<LocalDateTime>) (localDateTime, type, jsonSerializationContext) ->
|
.registerTypeAdapter(LocalDateTime.class, (JsonSerializer<LocalDateTime>) (localDateTime, type, jsonSerializationContext) ->
|
||||||
@@ -58,44 +56,29 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
.create();
|
.create();
|
||||||
|
|
||||||
private void sendWebSocketMsg(Notice notice) {
|
private void sendWebSocketMsg(Notice notice) {
|
||||||
if (notice.getSendStatus() > 0) {
|
String jsonNotice = gson.toJson(noticeConverter.toVO(notice));
|
||||||
String jsonNotice = gson.toJson(noticeConverter.toVO(notice));
|
websocketService.sendStringToFrontend(SecurityUtils.getUsername(), jsonNotice);
|
||||||
webSocketServer.sendStringToFrontend(SecurityUtils.getUsername(), jsonNotice);
|
|
||||||
List<SysUser> list = sysUserService.list();
|
|
||||||
for (SysUser sysUser : list) {
|
|
||||||
NoticeStatus noticeStatus = noticeStatusService.getOne(new LambdaQueryWrapper<NoticeStatus>().eq(NoticeStatus::getUserId, sysUser.getId()).eq(NoticeStatus::getNoticeId, notice.getId()));
|
|
||||||
if (noticeStatus == null) {
|
|
||||||
noticeStatus = new NoticeStatus();
|
|
||||||
noticeStatus.setUserId(sysUser.getId());
|
|
||||||
noticeStatus.setNoticeId(notice.getId());
|
|
||||||
noticeStatus.setReadStatus(0L);
|
|
||||||
noticeStatusService.save(noticeStatus);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通知公告分页列表
|
* 获取通知公告分页列表
|
||||||
*
|
*
|
||||||
* @param queryParams 查询参数
|
* @param queryParams 查询参数
|
||||||
* @return {@link IPage<NoticeVO>} 通知公告分页列表
|
* @return {@link IPage<NoticeVO>} 通知公告分页列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IPage<NoticeVO> getNoticePage(NoticeQuery queryParams) {
|
public IPage<NoticeVO> getNoticePage(NoticeQuery queryParams) {
|
||||||
Page<NoticeVO> pageVO = this.baseMapper.getNoticePage(
|
return this.baseMapper.getNoticePage(
|
||||||
new Page<>(queryParams.getPageNum(), queryParams.getPageSize()),
|
new Page<>(queryParams.getPageNum(), queryParams.getPageSize()),
|
||||||
queryParams
|
queryParams
|
||||||
);
|
);
|
||||||
return pageVO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通知公告表单数据
|
* 获取通知公告表单数据
|
||||||
*
|
*
|
||||||
* @param id 通知公告ID
|
* @param id 通知公告ID
|
||||||
* @return
|
* @return {@link NoticeForm} 通知公告表单对象
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public NoticeForm getNoticeFormData(Long id) {
|
public NoticeForm getNoticeFormData(Long id) {
|
||||||
@@ -107,20 +90,15 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
* 新增通知公告
|
* 新增通知公告
|
||||||
*
|
*
|
||||||
* @param formData 通知公告表单对象
|
* @param formData 通知公告表单对象
|
||||||
* @return
|
* @return {@link Boolean} 是否新增成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean saveNotice(NoticeForm formData) {
|
public boolean saveNotice(NoticeForm formData) {
|
||||||
Notice entity = noticeConverter.toEntity(formData);
|
Notice entity = noticeConverter.toEntity(formData);
|
||||||
entity.setCreateBy(SecurityUtils.getUserId());
|
if (entity.getTarType() == 1) {
|
||||||
entity.setReleaseBy(SecurityUtils.getUserId());
|
Assert.notBlank(entity.getTarIds(), "指定用户不能为空");
|
||||||
entity.setUpdateBy(SecurityUtils.getUserId());
|
|
||||||
entity.setIsDelete(0);
|
|
||||||
boolean result = this.save(entity);
|
|
||||||
if (result) {
|
|
||||||
sendWebSocketMsg(entity);
|
|
||||||
}
|
}
|
||||||
return result;
|
return this.save(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -128,36 +106,99 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
*
|
*
|
||||||
* @param id 通知公告ID
|
* @param id 通知公告ID
|
||||||
* @param formData 通知公告表单对象
|
* @param formData 通知公告表单对象
|
||||||
* @return
|
* @return {@link Boolean} 是否更新成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean updateNotice(Long id, NoticeForm formData) {
|
public boolean updateNotice(Long id, NoticeForm formData) {
|
||||||
Notice entity = noticeConverter.toEntity(formData);
|
Notice entity = noticeConverter.toEntity(formData);
|
||||||
entity.setUpdateBy(SecurityUtils.getUserId());
|
if (entity.getTarType() == 1) {
|
||||||
entity.setIsDelete(0);
|
Assert.notBlank(entity.getTarIds(), "指定用户不能为空");
|
||||||
boolean result = this.updateById(entity);
|
|
||||||
if (result) {
|
|
||||||
sendWebSocketMsg(entity);
|
|
||||||
}
|
}
|
||||||
return result;
|
return this.updateById(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除通知公告
|
* 删除通知公告
|
||||||
*
|
*
|
||||||
* @param ids 通知公告ID,多个以英文逗号(,)分割
|
* @param ids 通知公告ID,多个以英文逗号(,)分割
|
||||||
* @return
|
* @return {@link Boolean} 是否删除成功
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean deleteNotices(String ids) {
|
public boolean deleteNotices(String ids) {
|
||||||
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的通知公告数据为空");
|
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的通知公告数据为空");
|
||||||
// 逻辑删除
|
// 逻辑删除
|
||||||
List<Long> idList = Arrays.stream(ids.split(","))
|
List<Long> idList = Arrays.stream(ids.split(SymbolConstant.COMMA))
|
||||||
.map(Long::parseLong)
|
.map(Long::parseLong)
|
||||||
.toList();
|
.toList();
|
||||||
LambdaUpdateWrapper<Notice> wrapper = new LambdaUpdateWrapper<>();
|
boolean b = this.removeByIds(idList);
|
||||||
wrapper.in(Notice::getId, idList).set(Notice::getIsDelete, 1);
|
if (b) {
|
||||||
return this.update(wrapper);
|
//删除通知公告的同时,需要删除通知公告对应的用户通知状态
|
||||||
|
noticeStatusService.remove(new LambdaQueryWrapper<NoticeStatus>().in(NoticeStatus::getNoticeId, idList));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布通知公告
|
||||||
|
* @param id 通知公告ID
|
||||||
|
* @return 是否发布成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean releaseNotice(Long id) {
|
||||||
|
Notice notice = this.getById(id);
|
||||||
|
Assert.notNull(notice, "通知公告不存在");
|
||||||
|
Assert.isTrue(notice.getReleaseStatus() == 0, "通知公告已发布");
|
||||||
|
notice.setReleaseStatus(1);
|
||||||
|
notice.setReleaseTime(LocalDateTime.now());
|
||||||
|
this.updateById(notice);
|
||||||
|
//发布通知公告的同时,需要将通知公告发送给目标用户
|
||||||
|
//先删除掉该通知公告之前对应的用户信息
|
||||||
|
noticeStatusService.remove(new LambdaQueryWrapper<NoticeStatus>().eq(NoticeStatus::getNoticeId, id));
|
||||||
|
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (notice.getTarType() == 1) {
|
||||||
|
Assert.notBlank(notice.getTarIds(), "指定用户不能为空");
|
||||||
|
queryWrapper.in(User::getId, Arrays.asList(notice.getTarIds().split(SymbolConstant.COMMA)));
|
||||||
|
}
|
||||||
|
//查询出目标用户,增加用户通知状态
|
||||||
|
List<User> list = userService.list(queryWrapper);
|
||||||
|
List<NoticeStatus> needSaveList = list.stream().map(user -> {
|
||||||
|
NoticeStatus noticeStatus = new NoticeStatus();
|
||||||
|
noticeStatus.setNoticeId(id);
|
||||||
|
noticeStatus.setUserId(user.getId());
|
||||||
|
noticeStatus.setReadStatus(0);
|
||||||
|
return noticeStatus;
|
||||||
|
}).toList();
|
||||||
|
if(needSaveList.size() > 0){
|
||||||
|
noticeStatusService.saveBatch(needSaveList);
|
||||||
|
}
|
||||||
|
//最后,给当前在线的用户发送websocket消息
|
||||||
|
//TODO: 通知公告的websocket消息发送
|
||||||
|
return this.updateById(notice);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 撤回通知公告
|
||||||
|
*
|
||||||
|
* @param id 通知公告ID
|
||||||
|
* @return 是否撤回成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public boolean recallNotice(Long id) {
|
||||||
|
Notice notice = this.getById(id);
|
||||||
|
Assert.notNull(notice, "通知公告不存在");
|
||||||
|
Assert.isTrue(notice.getReleaseStatus() == 1, "通知公告未发布");
|
||||||
|
notice.setReleaseStatus(2);
|
||||||
|
notice.setRecallTime(LocalDateTime.now());
|
||||||
|
if (!this.updateById(notice)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//先删除掉该通知公告之前对应的用户信息
|
||||||
|
noticeStatusService.remove(new LambdaQueryWrapper<NoticeStatus>().eq(NoticeStatus::getNoticeId, id));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,11 @@
|
|||||||
package com.youlai.system.service.impl;
|
package com.youlai.boot.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.youlai.boot.system.mapper.NoticeStatusMapper;
|
||||||
|
import com.youlai.boot.system.model.entity.NoticeStatus;
|
||||||
|
import com.youlai.boot.system.service.NoticeStatusService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.youlai.system.mapper.NoticeStatusMapper;
|
|
||||||
import com.youlai.system.service.NoticeStatusService;
|
|
||||||
import com.youlai.system.model.entity.NoticeStatus;
|
|
||||||
import com.youlai.system.model.form.NoticeStatusForm;
|
|
||||||
import com.youlai.system.model.query.NoticeStatusQuery;
|
|
||||||
import com.youlai.system.model.vo.NoticeStatusVO;
|
|
||||||
import com.youlai.system.converter.NoticeStatusConverter;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import cn.hutool.core.lang.Assert;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户公告状态服务实现类
|
* 用户公告状态服务实现类
|
||||||
@@ -30,74 +17,4 @@ import cn.hutool.core.util.StrUtil;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class NoticeStatusServiceImpl extends ServiceImpl<NoticeStatusMapper, NoticeStatus> implements NoticeStatusService {
|
public class NoticeStatusServiceImpl extends ServiceImpl<NoticeStatusMapper, NoticeStatus> implements NoticeStatusService {
|
||||||
|
|
||||||
private final NoticeStatusConverter noticeStatusConverter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户公告状态分页列表
|
|
||||||
*
|
|
||||||
* @param queryParams 查询参数
|
|
||||||
* @return {@link IPage<NoticeStatusVO>} 用户公告状态分页列表
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IPage<NoticeStatusVO> getNoticeStatusPage(NoticeStatusQuery queryParams) {
|
|
||||||
Page<NoticeStatusVO> pageVO = this.baseMapper.getNoticeStatusPage(
|
|
||||||
new Page<>(queryParams.getPageNum(), queryParams.getPageSize()),
|
|
||||||
queryParams
|
|
||||||
);
|
|
||||||
return pageVO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取用户公告状态表单数据
|
|
||||||
*
|
|
||||||
* @param id 用户公告状态ID
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public NoticeStatusForm getNoticeStatusFormData(Long id) {
|
|
||||||
NoticeStatus entity = this.getById(id);
|
|
||||||
return noticeStatusConverter.toForm(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增用户公告状态
|
|
||||||
*
|
|
||||||
* @param formData 用户公告状态表单对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean saveNoticeStatus(NoticeStatusForm formData) {
|
|
||||||
NoticeStatus entity = noticeStatusConverter.toEntity(formData);
|
|
||||||
return this.save(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新用户公告状态
|
|
||||||
*
|
|
||||||
* @param id 用户公告状态ID
|
|
||||||
* @param formData 用户公告状态表单对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean updateNoticeStatus(Long id,NoticeStatusForm formData) {
|
|
||||||
NoticeStatus entity = noticeStatusConverter.toEntity(formData);
|
|
||||||
return this.updateById(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除用户公告状态
|
|
||||||
*
|
|
||||||
* @param ids 用户公告状态ID,多个以英文逗号(,)分割
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean deleteNoticeStatuss(String ids) {
|
|
||||||
Assert.isTrue(StrUtil.isNotBlank(ids), "删除的用户公告状态数据为空");
|
|
||||||
// 逻辑删除
|
|
||||||
List<Long> idList = Arrays.stream(ids.split(","))
|
|
||||||
.map(Long::parseLong)
|
|
||||||
.toList();
|
|
||||||
return this.removeByIds(idList);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.youlai.system.mapper.NoticeMapper">
|
<mapper namespace="com.youlai.boot.system.mapper.NoticeMapper">
|
||||||
|
|
||||||
<!-- 获取通知公告分页列表 -->
|
<!-- 获取通知公告分页列表 -->
|
||||||
<select id="getNoticePage" resultType="com.youlai.system.model.vo.NoticeVO">
|
<select id="getNoticePage" resultType="com.youlai.boot.system.model.vo.NoticeVO">
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
sn.id,
|
||||||
title,
|
sn.title,
|
||||||
content,
|
sn.notice_type,
|
||||||
notice_type,
|
su.nickname AS release_by,
|
||||||
release_by,
|
sn.priority,
|
||||||
priority,
|
sn.tar_type,
|
||||||
tar_type,
|
sn.release_status,
|
||||||
send_status,
|
sn.release_time,
|
||||||
send_time,
|
sn.recall_time
|
||||||
recall_time,
|
|
||||||
create_time,
|
|
||||||
update_time
|
|
||||||
FROM
|
FROM
|
||||||
sys_notice
|
sys_notice sn
|
||||||
<where>
|
LEFT JOIN
|
||||||
|
sys_user su ON su.id = sn.release_by
|
||||||
|
where
|
||||||
|
sn.is_deleted = 0
|
||||||
<if test="queryParams.title != null and queryParams.title != ''">
|
<if test="queryParams.title != null and queryParams.title != ''">
|
||||||
AND title = #{queryParams.title}
|
AND sn.title LIKE CONCAT('%',#{queryParams.title},'%')
|
||||||
</if>
|
</if>
|
||||||
<if test="queryParams.content != null and queryParams.content != ''">
|
<if test="queryParams.releaseStatus != null">
|
||||||
AND content = #{queryParams.content}
|
AND sn.release_status = #{queryParams.releaseStatus}
|
||||||
</if>
|
</if>
|
||||||
<if test="queryParams.noticeType != null">
|
<if test="queryParams.releaseTime != null">
|
||||||
AND notice_type = #{queryParams.noticeType}
|
<if test="queryParams.releaseTime[0] != null and queryParams.releaseTime[0] != ''">
|
||||||
</if>
|
<bind name="startDate" value="queryParams.releaseTime[0].length() == 10 ? queryParams.releaseTime[0] + ' 00:00:00' : queryParams.releaseTime[0]"/>
|
||||||
<if test="queryParams.releaseBy != null">
|
AND sn.release_time >= #{startDate}
|
||||||
AND release_by = #{queryParams.releaseBy}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.priority != null">
|
|
||||||
AND priority = #{queryParams.priority}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.tarType != null">
|
|
||||||
AND tar_type = #{queryParams.tarType}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.sendStatus != null">
|
|
||||||
AND send_status = #{queryParams.sendStatus}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.sendTime != null">
|
|
||||||
<if test="queryParams.sendTime[0] != null and queryParams.sendTime[0] != ''">
|
|
||||||
<bind name="startDate" value="queryParams.sendTime[0].length() == 10 ? queryParams.sendTime[0] + ' 00:00:00' : queryParams.sendTime[0]"/>
|
|
||||||
AND send_time >= #{startDate}
|
|
||||||
</if>
|
</if>
|
||||||
<if test="queryParams.sendTime[1] != null and queryParams.sendTime[1] != ''">
|
<if test="queryParams.releaseTime[1] != null and queryParams.releaseTime[1] != ''">
|
||||||
<bind name="endDate" value="queryParams.sendTime[1].length() == 10 ? queryParams.sendTime[1] + ' 23:59:59' : queryParams.sendTime[1]"/>
|
<bind name="endDate" value="queryParams.releaseTime[1].length() == 10 ? queryParams.releaseTime[1] + ' 23:59:59' : queryParams.releaseTime[1]"/>
|
||||||
AND send_time <= #{endDate}
|
AND sn.release_time <= #{endDate}
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
<if test="queryParams.recallTime != null">
|
ORDER BY
|
||||||
<if test="queryParams.recallTime[0] != null and queryParams.recallTime[0] != ''">
|
id
|
||||||
<bind name="startDate" value="queryParams.recallTime[0].length() == 10 ? queryParams.recallTime[0] + ' 00:00:00' : queryParams.recallTime[0]"/>
|
DESC
|
||||||
AND recall_time >= #{startDate}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.recallTime[1] != null and queryParams.recallTime[1] != ''">
|
|
||||||
<bind name="endDate" value="queryParams.recallTime[1].length() == 10 ? queryParams.recallTime[1] + ' 23:59:59' : queryParams.recallTime[1]"/>
|
|
||||||
AND recall_time <= #{endDate}
|
|
||||||
</if>
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -1,41 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.youlai.system.mapper.NoticeStatusMapper">
|
<mapper namespace="com.youlai.boot.system.mapper.NoticeStatusMapper">
|
||||||
|
|
||||||
<!-- 获取用户公告状态分页列表 -->
|
|
||||||
<select id="getNoticeStatusPage" resultType="com.youlai.system.model.vo.NoticeStatusVO">
|
|
||||||
SELECT
|
|
||||||
id,
|
|
||||||
notice_id,
|
|
||||||
user_id,
|
|
||||||
read_status,
|
|
||||||
read_tiem
|
|
||||||
FROM
|
|
||||||
sys_notice_status
|
|
||||||
<where>
|
|
||||||
<if test="queryParams.id != null">
|
|
||||||
AND id = #{queryParams.id}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.noticeId != null">
|
|
||||||
AND notice_id = #{queryParams.noticeId}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.userId != null">
|
|
||||||
AND user_id = #{queryParams.userId}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.readStatus != null">
|
|
||||||
AND read_status = #{queryParams.readStatus}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.readTiem != null">
|
|
||||||
<if test="queryParams.readTiem[0] != null and queryParams.readTiem[0] != ''">
|
|
||||||
<bind name="startDate" value="queryParams.readTiem[0].length() == 10 ? queryParams.readTiem[0] + ' 00:00:00' : queryParams.readTiem[0]"/>
|
|
||||||
AND read_tiem >= #{startDate}
|
|
||||||
</if>
|
|
||||||
<if test="queryParams.readTiem[1] != null and queryParams.readTiem[1] != ''">
|
|
||||||
<bind name="endDate" value="queryParams.readTiem[1].length() == 10 ? queryParams.readTiem[1] + ' 23:59:59' : queryParams.readTiem[1]"/>
|
|
||||||
AND read_tiem <= #{endDate}
|
|
||||||
</if>
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user