|
|
@@ -56,6 +56,9 @@ public class ChatMsgController extends BaseController {
|
|
|
@PostMapping("/send")
|
|
|
public AjaxResult send(@RequestBody ChatMsg msg) {
|
|
|
msg.setFromId(SecurityUtils.getUserId());
|
|
|
+ if (msg.getFromId().equals(msg.getToId())) {
|
|
|
+ return error("不允许给自己发送消息");
|
|
|
+ }
|
|
|
msg.setCreateTime(new Date());
|
|
|
stringRedisTemplate.convertAndSend(CacheConstants.CHANNEL, JSON.toJSONString(msg));
|
|
|
chatMsgService.insertChatMsg(msg);
|
|
|
@@ -90,7 +93,7 @@ public class ChatMsgController extends BaseController {
|
|
|
* 查询聊天消息管理列表
|
|
|
*/
|
|
|
@ApiOperation("查询聊天消息管理列表")
|
|
|
- @PreAuthorize("@ss.hasPermi('chat:msg:list')")
|
|
|
+// @PreAuthorize("@ss.hasPermi('chat:msg:list')")
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(ChatMsg chatMsg) {
|
|
|
startPage();
|
|
|
@@ -102,8 +105,8 @@ public class ChatMsgController extends BaseController {
|
|
|
* 导出聊天消息管理列表
|
|
|
*/
|
|
|
@ApiOperation("导出聊天消息管理列表")
|
|
|
- @PreAuthorize("@ss.hasPermi('chat:msg:export')")
|
|
|
- @Log(title = "聊天消息管理" , businessType = BusinessType.EXPORT)
|
|
|
+// @PreAuthorize("@ss.hasPermi('chat:msg:export')")
|
|
|
+ @Log(title = "聊天消息管理", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
public void export(HttpServletResponse response, ChatMsg chatMsg) {
|
|
|
List<ChatMsg> list = chatMsgService.selectChatMsgList(chatMsg);
|
|
|
@@ -115,7 +118,7 @@ public class ChatMsgController extends BaseController {
|
|
|
* 获取聊天消息管理详细信息
|
|
|
*/
|
|
|
@ApiOperation("获取聊天消息管理详细信息")
|
|
|
- @PreAuthorize("@ss.hasPermi('chat:msg:query')")
|
|
|
+// @PreAuthorize("@ss.hasPermi('chat:msg:query')")
|
|
|
@GetMapping(value = "/{msgId}")
|
|
|
public AjaxResult getInfo(@PathVariable("msgId") Long msgId) {
|
|
|
return success(chatMsgService.selectChatMsgByMsgId(msgId));
|
|
|
@@ -125,8 +128,8 @@ public class ChatMsgController extends BaseController {
|
|
|
* 新增聊天消息管理
|
|
|
*/
|
|
|
@ApiOperation("新增聊天消息管理")
|
|
|
- @PreAuthorize("@ss.hasPermi('chat:msg:add')")
|
|
|
- @Log(title = "聊天消息管理" , businessType = BusinessType.INSERT)
|
|
|
+// @PreAuthorize("@ss.hasPermi('chat:msg:add')")
|
|
|
+ @Log(title = "聊天消息管理", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody ChatMsg chatMsg) {
|
|
|
return toAjax(chatMsgService.insertChatMsg(chatMsg));
|
|
|
@@ -136,8 +139,8 @@ public class ChatMsgController extends BaseController {
|
|
|
* 修改聊天消息管理
|
|
|
*/
|
|
|
@ApiOperation("修改聊天消息管理")
|
|
|
- @PreAuthorize("@ss.hasPermi('chat:msg:edit')")
|
|
|
- @Log(title = "聊天消息管理" , businessType = BusinessType.UPDATE)
|
|
|
+// @PreAuthorize("@ss.hasPermi('chat:msg:edit')")
|
|
|
+ @Log(title = "聊天消息管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody ChatMsg chatMsg) {
|
|
|
return toAjax(chatMsgService.updateChatMsg(chatMsg));
|
|
|
@@ -147,8 +150,8 @@ public class ChatMsgController extends BaseController {
|
|
|
* 删除聊天消息管理
|
|
|
*/
|
|
|
@ApiOperation("删除聊天消息管理")
|
|
|
- @PreAuthorize("@ss.hasPermi('chat:msg:remove')")
|
|
|
- @Log(title = "聊天消息管理" , businessType = BusinessType.DELETE)
|
|
|
+// @PreAuthorize("@ss.hasPermi('chat:msg:remove')")
|
|
|
+ @Log(title = "聊天消息管理", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{msgIds}")
|
|
|
public AjaxResult remove(@PathVariable Long[] msgIds) {
|
|
|
return toAjax(chatMsgService.deleteChatMsgByMsgIds(msgIds));
|