查看消息列表
parent
082ca6ff3a
commit
aa5e71b065
@ -0,0 +1,55 @@
|
||||
package com.flossom.miniProgram.controller;
|
||||
|
||||
import com.flossom.common.core.domain.R;
|
||||
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
||||
import com.flossom.common.core.web.controller.BaseController;
|
||||
import com.flossom.common.core.web.page.TableDataInfo;
|
||||
import com.flossom.miniProgram.service.IWxUserScriptLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发送话术记录Controller
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/userScriptLog")
|
||||
public class WxUserScriptLogController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWxUserScriptLogService wxUserScriptLogService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询发送话术记录列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list() {
|
||||
startPage();
|
||||
List<WxUserScriptLog> list = wxUserScriptLogService.selectWxUserScriptLogList();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询是否有没未读消息
|
||||
*/
|
||||
@GetMapping("getNoReadMessageNum")
|
||||
public R getNoReadMessageNum() {
|
||||
return R.ok(wxUserScriptLogService.getNoReadMessageNum());
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发所有已读
|
||||
*/
|
||||
@GetMapping("/hasBeenRead")
|
||||
public R hasBeenRead() {
|
||||
wxUserScriptLogService.hasBeenRead();
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.flossom.miniProgram.service;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IWxUserScriptLogService {
|
||||
List<WxUserScriptLog> selectWxUserScriptLogList();
|
||||
|
||||
Integer getNoReadMessageNum();
|
||||
|
||||
void hasBeenRead();
|
||||
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.flossom.miniProgram.service.impl;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
||||
import com.flossom.common.core.enums.Status;
|
||||
import com.flossom.common.core.mapper.WxUserScriptLogMapper;
|
||||
import com.flossom.common.security.utils.SecurityUtils;
|
||||
import com.flossom.miniProgram.service.IWxUserScriptLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class WxUserScriptLogServiceImpl implements IWxUserScriptLogService {
|
||||
|
||||
@Autowired
|
||||
private WxUserScriptLogMapper wxUserScriptLogMapper;
|
||||
|
||||
@Override
|
||||
public List<WxUserScriptLog> selectWxUserScriptLogList() {
|
||||
WxUserScriptLog query = new WxUserScriptLog();
|
||||
// 消息归属人
|
||||
query.setWxUserId(SecurityUtils.getWxUserId());
|
||||
// 消息状态正常
|
||||
query.setStatus(Status.OK.getCode());
|
||||
return wxUserScriptLogMapper.selectWxUserScriptLogList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getNoReadMessageNum() {
|
||||
WxUserScriptLog query = new WxUserScriptLog();
|
||||
// 消息归属人
|
||||
query.setWxUserId(SecurityUtils.getWxUserId());
|
||||
// 消息状态正常
|
||||
query.setStatus(Status.OK.getCode());
|
||||
// 未读
|
||||
query.setIsRead(0);
|
||||
return wxUserScriptLogMapper.getNoReadMessageNum(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hasBeenRead() {
|
||||
WxUserScriptLog query = new WxUserScriptLog();
|
||||
// 消息归属人
|
||||
query.setWxUserId(20L);
|
||||
// 消息状态正常
|
||||
query.setStatus(Status.OK.getCode());
|
||||
// 未读
|
||||
query.setIsRead(0);
|
||||
wxUserScriptLogMapper.hasBeenRead(query);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue