客户超额消息通知
This commit is contained in:
+142
@@ -0,0 +1,142 @@
|
||||
package com.bms.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bms.common.annotation.Log;
|
||||
import com.bms.common.core.controller.BaseController;
|
||||
import com.bms.common.core.domain.AjaxResult;
|
||||
import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.enums.BusinessType;
|
||||
import com.bms.common.utils.SecurityUtils;
|
||||
import com.bms.notify.domain.NotifyMessage;
|
||||
import com.bms.notify.domain.NotifyRule;
|
||||
import com.bms.notify.service.INotifyService;
|
||||
|
||||
/**
|
||||
* 消息通知管理(系统管理)
|
||||
*
|
||||
* <p>规则/消息管理需 system:notify:* 权限;“我的消息”系列接口所有登录用户可用。</p>
|
||||
*
|
||||
* @author bms
|
||||
* @date 2026-10-09
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/notify")
|
||||
public class SysNotifyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private INotifyService notifyService;
|
||||
|
||||
/* ================= 通知规则 ================= */
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:notify:list')")
|
||||
@GetMapping("/rule/list")
|
||||
public TableDataInfo ruleList(NotifyRule query)
|
||||
{
|
||||
startPage();
|
||||
return getDataTable(notifyService.selectRuleList(query));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:notify:query')")
|
||||
@GetMapping("/rule/{ruleId}")
|
||||
public AjaxResult getRule(@PathVariable Long ruleId)
|
||||
{
|
||||
return success(notifyService.selectRuleById(ruleId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:notify:add')")
|
||||
@Log(title = "消息通知规则", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/rule")
|
||||
public AjaxResult addRule(@RequestBody NotifyRule rule)
|
||||
{
|
||||
return toAjax(notifyService.insertRule(rule));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:notify:edit')")
|
||||
@Log(title = "消息通知规则", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/rule")
|
||||
public AjaxResult editRule(@RequestBody NotifyRule rule)
|
||||
{
|
||||
return toAjax(notifyService.updateRule(rule));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:notify:remove')")
|
||||
@Log(title = "消息通知规则", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/rule/{ruleIds}")
|
||||
public AjaxResult removeRule(@PathVariable Long[] ruleIds)
|
||||
{
|
||||
return toAjax(notifyService.deleteRuleByIds(ruleIds));
|
||||
}
|
||||
|
||||
/** 立即执行一次超额扫描(测试/补发用) */
|
||||
@PreAuthorize("@ss.hasPermi('system:notify:edit')")
|
||||
@Log(title = "客户超额通知扫描", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/scan")
|
||||
public AjaxResult scanNow()
|
||||
{
|
||||
int count = notifyService.scanCustomerOverdue();
|
||||
return AjaxResult.success("扫描完成,新生成通知 " + count + " 条", count);
|
||||
}
|
||||
|
||||
/* ================= 通知记录 ================= */
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:notify:list')")
|
||||
@GetMapping("/message/list")
|
||||
public TableDataInfo messageList(NotifyMessage query)
|
||||
{
|
||||
startPage();
|
||||
return getDataTable(notifyService.selectMessageList(query));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:notify:query')")
|
||||
@GetMapping("/message/{messageId}")
|
||||
public AjaxResult getMessage(@PathVariable Long messageId)
|
||||
{
|
||||
return success(notifyService.selectMessageById(messageId));
|
||||
}
|
||||
|
||||
/* ================= 我的消息(所有登录用户) ================= */
|
||||
|
||||
/** 登录后待弹屏消息;拉取即置弹屏已展示,避免刷新/每次进首页重复打扰 */
|
||||
@GetMapping("/mine/popup")
|
||||
public AjaxResult minePopup()
|
||||
{
|
||||
return success(notifyService.popupAndMarkShown(SecurityUtils.getUserId()));
|
||||
}
|
||||
|
||||
@GetMapping("/mine/list")
|
||||
public AjaxResult mineList(@RequestParam(required = false) String readFlag)
|
||||
{
|
||||
return success(notifyService.selectMineList(SecurityUtils.getUserId(), readFlag));
|
||||
}
|
||||
|
||||
@GetMapping("/mine/count")
|
||||
public AjaxResult mineCount()
|
||||
{
|
||||
return success(notifyService.countUnread(SecurityUtils.getUserId()));
|
||||
}
|
||||
|
||||
@Log(title = "我的通知-已读", businessType = BusinessType.OTHER)
|
||||
@PutMapping("/mine/read/{receiveId}")
|
||||
public AjaxResult mineRead(@PathVariable Long receiveId)
|
||||
{
|
||||
return toAjax(notifyService.markRead(receiveId, SecurityUtils.getUserId()));
|
||||
}
|
||||
|
||||
@Log(title = "我的通知-全部已读", businessType = BusinessType.OTHER)
|
||||
@PutMapping("/mine/readAll")
|
||||
public AjaxResult mineReadAll()
|
||||
{
|
||||
return toAjax(notifyService.markAllRead(SecurityUtils.getUserId()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user