feat: 完成消息通知中心全功能开发
1. 新增消息通知相关实体、Mapper、Service、控制器与前端页面 2. 实现审批通知、报价到期提醒等通知发送逻辑 3. 完成通知菜单配置与路由注册 4. 修复通知数据与跳转路径问题 5. 新增配套SQL脚本与定时任务
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
package com.ruoyi.web.controller.bid;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.system.domain.bid.BizNotifyMessage;
|
||||
import com.ruoyi.system.domain.bid.BizNotifyRule;
|
||||
import com.ruoyi.system.service.bid.IBizNotifyMessageService;
|
||||
import com.ruoyi.system.service.bid.IBizNotifyRuleService;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/bid/notify")
|
||||
public class BizNotifyController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IBizNotifyMessageService notifyMessageService;
|
||||
|
||||
@Autowired
|
||||
private IBizNotifyRuleService notifyRuleService;
|
||||
|
||||
// ==================== 消息通知接口 ====================
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BizNotifyMessage query) {
|
||||
// 强制按当前用户过滤
|
||||
query.setUserId(SecurityUtils.getUserId());
|
||||
startPage();
|
||||
List<BizNotifyMessage> list = notifyMessageService.selectNotifyMessageList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:list')")
|
||||
@GetMapping("/unreadCount")
|
||||
public AjaxResult unreadCount() {
|
||||
return success(notifyMessageService.selectUnreadCount(SecurityUtils.getUserId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:list')")
|
||||
@GetMapping("/topUnread")
|
||||
public AjaxResult topUnread(@RequestParam(defaultValue = "5") int limit) {
|
||||
return success(notifyMessageService.selectTopUnread(SecurityUtils.getUserId(), limit));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:list')")
|
||||
@GetMapping("/topNotify")
|
||||
public AjaxResult topNotify(@RequestParam(defaultValue = "10") int limit) {
|
||||
return success(notifyMessageService.selectTopNotify(SecurityUtils.getUserId(), limit));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:list')")
|
||||
@GetMapping("/stats")
|
||||
public AjaxResult stats() {
|
||||
return success(notifyMessageService.selectNotifyStats(SecurityUtils.getUserId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:query')")
|
||||
@GetMapping("/{messageId}")
|
||||
public AjaxResult getInfo(@PathVariable("messageId") Long messageId) {
|
||||
return success(notifyMessageService.selectNotifyMessageById(messageId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:read')")
|
||||
@PutMapping("/read/{messageId}")
|
||||
public AjaxResult markRead(@PathVariable("messageId") Long messageId) {
|
||||
return toAjax(notifyMessageService.markAsRead(messageId, SecurityUtils.getUserId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:read')")
|
||||
@PutMapping("/readAll")
|
||||
public AjaxResult markAllRead() {
|
||||
return toAjax(notifyMessageService.markAllAsRead(SecurityUtils.getUserId()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:remove')")
|
||||
@Log(title = "消息通知", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{messageIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] messageIds) {
|
||||
return toAjax(notifyMessageService.deleteNotifyMessageByIds(messageIds));
|
||||
}
|
||||
|
||||
// ==================== 通知规则接口 ====================
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:rule')")
|
||||
@GetMapping("/rule/list")
|
||||
public TableDataInfo ruleList(BizNotifyRule query) {
|
||||
startPage();
|
||||
List<BizNotifyRule> list = notifyRuleService.selectNotifyRuleList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:rule')")
|
||||
@GetMapping("/rule/{ruleId}")
|
||||
public AjaxResult getRule(@PathVariable("ruleId") Long ruleId) {
|
||||
return success(notifyRuleService.selectNotifyRuleById(ruleId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:rule')")
|
||||
@Log(title = "通知规则", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/rule")
|
||||
public AjaxResult addRule(@RequestBody BizNotifyRule rule) {
|
||||
rule.setCreateBy(getUsername());
|
||||
return toAjax(notifyRuleService.insertNotifyRule(rule));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:rule')")
|
||||
@Log(title = "通知规则", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/rule")
|
||||
public AjaxResult editRule(@RequestBody BizNotifyRule rule) {
|
||||
rule.setUpdateBy(getUsername());
|
||||
return toAjax(notifyRuleService.updateNotifyRule(rule));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('bid:notify:rule')")
|
||||
@Log(title = "通知规则", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/rule/{ruleIds}")
|
||||
public AjaxResult removeRule(@PathVariable Long[] ruleIds) {
|
||||
return toAjax(notifyRuleService.deleteNotifyRuleByIds(ruleIds));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user