Commit 68e48ebd authored by yf's avatar yf

修改代办、消息相关接口

parent 38cdec23
...@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.service.IMessageInfoService;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -35,11 +36,14 @@ public class BacklogInfoController extends BaseController { ...@@ -35,11 +36,14 @@ public class BacklogInfoController extends BaseController {
@Autowired @Autowired
private IBacklogInfoService backlogInfoService; private IBacklogInfoService backlogInfoService;
@Autowired
private IMessageInfoService messageInfoService;
/** /**
* 查询待办信息列表 * 查询待办信息列表
*/ */
@PreAuthorize("@ss.hasPermi('system:backlogInfo:list')") @PreAuthorize("@ss.hasPermi('system:backlogInfo:list')")
@GetMapping("/list") @PostMapping("/list")
public TableDataInfo list(BacklogInfo backlogInfo) { public TableDataInfo list(BacklogInfo backlogInfo) {
startPage(); startPage();
String loginName = getUsername(); String loginName = getUsername();
...@@ -72,7 +76,9 @@ public class BacklogInfoController extends BaseController { ...@@ -72,7 +76,9 @@ public class BacklogInfoController extends BaseController {
Map<String, Integer> map = new HashMap<>(); Map<String, Integer> map = new HashMap<>();
String loginName = getUsername(); String loginName = getUsername();
int backlogInfo = backlogInfoService.selectUnReadCount(loginName, "app_url", "menu_url"); int backlogInfo = backlogInfoService.selectUnReadCount(loginName, "app_url", "menu_url");
int messageInfo = messageInfoService.selectUnReadCount(loginName);
map.put("待办事项", backlogInfo); map.put("待办事项", backlogInfo);
map.put("消息信息", messageInfo);
return AjaxResult.success(map); return AjaxResult.success(map);
} }
......
package com.ruoyi.system.controller; package com.ruoyi.system.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
...@@ -56,6 +57,16 @@ public class MessageInfoController extends BaseController ...@@ -56,6 +57,16 @@ public class MessageInfoController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 清除未读
*/
@GetMapping("/changeStatus")
@ResponseBody
public AjaxResult changeStatus(HttpServletRequest httpServletRequest) {
String loginName = getUsername();
return toAjax(messageInfoService.updateChangeStatus(loginName));
}
/** /**
* 导出消息信息列表 * 导出消息信息列表
......
...@@ -79,4 +79,11 @@ public class BacklogInfo extends BaseEntity ...@@ -79,4 +79,11 @@ public class BacklogInfo extends BaseEntity
@TableField(exist = false) @TableField(exist = false)
private String endTime; private String endTime;
/**
* 结束时间
*/
@Excel(name = "结束时间")
@TableField(exist = false)
private String keyword;
} }
...@@ -71,5 +71,11 @@ public class MessageInfo extends BaseEntity ...@@ -71,5 +71,11 @@ public class MessageInfo extends BaseEntity
@Excel(name = "结束时间") @Excel(name = "结束时间")
@TableField(exist = false) @TableField(exist = false)
private String endTime; private String endTime;
/**
* 结束时间
*/
@Excel(name = "结束时间")
@TableField(exist = false)
private String keyword;
} }
...@@ -20,6 +20,11 @@ public interface MessageInfoMapper extends MPJBaseMapper<MessageInfo> ...@@ -20,6 +20,11 @@ public interface MessageInfoMapper extends MPJBaseMapper<MessageInfo>
*/ */
public MessageInfo selectMessageInfoById(String id); public MessageInfo selectMessageInfoById(String id);
/**
* 查询消息未读信息数量
*/
public int selectUnReadCount(String loginName);
/** /**
* 查询消息信息列表 * 查询消息信息列表
* *
...@@ -36,6 +41,11 @@ public interface MessageInfoMapper extends MPJBaseMapper<MessageInfo> ...@@ -36,6 +41,11 @@ public interface MessageInfoMapper extends MPJBaseMapper<MessageInfo>
*/ */
public int insertMessageInfo(MessageInfo messageInfo); public int insertMessageInfo(MessageInfo messageInfo);
/**
* 清除未读
*/
public boolean updateChangeStatus(String loginName);
/** /**
* 修改消息信息 * 修改消息信息
* *
......
package com.censoft.censoftrongtong.service;
/**
* 消息中心Service公共接口
*
* @author censoft
* @date 2021-11-16
*/
public interface ICommonMessageInfoService {
/**
* 新增消息信息
*
* @return 结果
*/
public int insertMessageInfo(String pid, String nodeId, String title, String content, String status, String messageBy, String menuName, String menuUrl, String appUrl, String createBy);
/**
* 新增通知公告
*
* @return 结果
*/
// public int insertNoticeInfo(String pid, String title, String content, String status, String noticeBy, String menuName, String menuUrl, String appUrl, String createBy);
/**
* 新增待办信息
*
* @return 结果
*/
public int insertBacklogInfo(String pid, String nodeId, String mainId, String title, String theme, String content, String status, String backlogBy, String menuName, String menuUrl, String appUrl, String createBy);
/**
* 修改待办信息
*
* @return 结果
*/
public int updateBacklogInfo(String pid, String nodeId, String status, String backlogBy, String menuUrl, String appUrl);
/**
* 修改待办信息
*
* @return 结果
*/
public int updateBacklogInfoByPid(String pid, String nodeId, String status, String backlogBy, String menuUrl, String appUrl);
}
...@@ -19,6 +19,11 @@ public interface IMessageInfoService extends MPJBaseService<MessageInfo> ...@@ -19,6 +19,11 @@ public interface IMessageInfoService extends MPJBaseService<MessageInfo>
*/ */
public MessageInfo selectMessageInfoById(String id); public MessageInfo selectMessageInfoById(String id);
/**
* 查询消息未读信息数量
*/
public int selectUnReadCount(String loginName);
/** /**
* 查询消息信息列表 * 查询消息信息列表
* *
...@@ -27,6 +32,12 @@ public interface IMessageInfoService extends MPJBaseService<MessageInfo> ...@@ -27,6 +32,12 @@ public interface IMessageInfoService extends MPJBaseService<MessageInfo>
*/ */
public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo); public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo);
/**
* 清除未读
*/
public boolean updateChangeStatus(String loginName);
/** /**
* 新增消息信息 * 新增消息信息
* *
......
package com.censoft.censoftrongtong.service.impl;
import com.censoft.censoftrongtong.service.ICommonMessageInfoService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.BacklogInfo;
import com.ruoyi.system.domain.MessageInfo;
import com.ruoyi.system.mapper.BacklogInfoMapper;
import com.ruoyi.system.mapper.MessageInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.UUID;
public class CommonMessageInfoServiceImpl implements ICommonMessageInfoService {
@Autowired
private MessageInfoMapper messageInfoMapper;
@Autowired
private BacklogInfoMapper backlogInfoMapper;
/**
* 新增消息信息
*
* @return 结果
*/
@Override
public int insertMessageInfo(String pid, String nodeId, String title, String content, String status, String messageBy, String menuName, String menuUrl, String appUrl, String createBy) {
MessageInfo messageInfo = new MessageInfo();
messageInfo.setId(UUID.randomUUID().toString().replace("-", ""));
if (StringUtils.isNotNull(pid) && StringUtils.isNotEmpty(pid)) {
messageInfo.setPid(pid);
}
if (StringUtils.isNotNull(nodeId) && StringUtils.isNotEmpty(nodeId)) {
messageInfo.setNodeId(nodeId);
}
if (StringUtils.isNotNull(title) && StringUtils.isNotEmpty(title)) {
messageInfo.setTitle(title);
}
if (StringUtils.isNotNull(content) && StringUtils.isNotEmpty(content)) {
messageInfo.setContent(content);
}
if (StringUtils.isNotNull(status) && StringUtils.isNotEmpty(status)) {
messageInfo.setStatus(status);
}
if (StringUtils.isNotNull(messageBy) && StringUtils.isNotEmpty(messageBy)) {
messageInfo.setMessageBy(messageBy);
}
if (StringUtils.isNotNull(menuName) && StringUtils.isNotEmpty(menuName)) {
messageInfo.setMenuName(menuName);
}
if (StringUtils.isNotNull(menuUrl) && StringUtils.isNotEmpty(menuUrl)) {
messageInfo.setMenuUrl(menuUrl);
}
if (StringUtils.isNotNull(appUrl) && StringUtils.isNotEmpty(appUrl)) {
messageInfo.setAppUrl(appUrl);
}
if (StringUtils.isNotNull(createBy) && StringUtils.isNotEmpty(createBy)) {
messageInfo.setCreateBy(createBy);
}
messageInfo.setCreateTime(DateUtils.getNowDate());
return messageInfoMapper.insertMessageInfo(messageInfo);
}
// /**
// * 新增通知公告
// *
// * @return 结果
// */
// @Override
// public int insertNoticeInfo(String pid, String title, String content, String status, String noticeBy, String menuName, String menuUrl, String appUrl, String createBy) {
// NoticeInfo noticeInfo = new NoticeInfo();
// noticeInfo.setId(UUID.randomUUID().toString().replace("-", ""));
// if (StringUtils.isNotNull(title) && StringUtils.isNotEmpty(title)) {
// noticeInfo.setTitle(title);
// }
// if (StringUtils.isNotNull(content) && StringUtils.isNotEmpty(content)) {
// noticeInfo.setContent(content);
// }
// if (StringUtils.isNotNull(createBy) && StringUtils.isNotEmpty(createBy)) {
// noticeInfo.setCreateBy(createBy);
// }
// noticeInfo.setCreateTime(DateUtils.getNowDate());
// return noticeInfoMapper.insertNoticeInfo(noticeInfo);
// }
/**
* 新增待办信息
*
* @return 结果
*/
@Override
public int insertBacklogInfo(String pid, String nodeId, String mainId, String title, String theme, String content, String status, String backlogBy, String menuName, String menuUrl, String appUrl, String createBy) {
BacklogInfo backlogInfo = new BacklogInfo();
backlogInfo.setId(UUID.randomUUID().toString().replace("-", ""));
if (StringUtils.isNotNull(pid) && StringUtils.isNotEmpty(pid)) {
backlogInfo.setPid(pid);
}
if (StringUtils.isNotNull(nodeId) && StringUtils.isNotEmpty(nodeId)) {
backlogInfo.setNodeId(nodeId);
}
if (StringUtils.isNotNull(mainId) && StringUtils.isNotEmpty(mainId)) {
backlogInfo.setMainId(mainId);
}
if (StringUtils.isNotNull(title) && StringUtils.isNotEmpty(title)) {
backlogInfo.setTitle(title);
}
if (StringUtils.isNotNull(theme) && StringUtils.isNotEmpty(theme)) {
backlogInfo.setTheme(theme);
}
if (StringUtils.isNotNull(content) && StringUtils.isNotEmpty(content)) {
backlogInfo.setContent(content);
}
if (StringUtils.isNotNull(status) && StringUtils.isNotEmpty(status)) {
backlogInfo.setStatus(status);
}
if (StringUtils.isNotNull(backlogBy) && StringUtils.isNotEmpty(backlogBy)) {
backlogInfo.setBacklogBy(backlogBy);
}
if (StringUtils.isNotNull(menuName) && StringUtils.isNotEmpty(menuName)) {
backlogInfo.setMenuName(menuName);
}
if (StringUtils.isNotNull(menuUrl) && StringUtils.isNotEmpty(menuUrl)) {
backlogInfo.setMenuUrl(menuUrl);
}
if (StringUtils.isNotNull(appUrl) && StringUtils.isNotEmpty(appUrl)) {
backlogInfo.setAppUrl(appUrl);
}
if (StringUtils.isNotNull(createBy) && StringUtils.isNotEmpty(createBy)) {
backlogInfo.setCreateBy(createBy);
}
backlogInfo.setCreateTime(DateUtils.getNowDate());
return backlogInfoMapper.insertBacklogInfo(backlogInfo);
}
/**
* 修改待办信息
*
* @return 结果
*/
@Override
public int updateBacklogInfo(String pid, String nodeId, String status, String updateBy, String menuUrl, String appUrl) {
BacklogInfo backlogInfo = new BacklogInfo();
if (StringUtils.isNotNull(pid) && StringUtils.isNotEmpty(pid)) {
backlogInfo.setPid(pid);
}
if (StringUtils.isNotNull(nodeId) && StringUtils.isNotEmpty(nodeId)) {
backlogInfo.setNodeId(nodeId);
}
if (StringUtils.isNotNull(status) && StringUtils.isNotEmpty(status)) {
backlogInfo.setStatus(status);
}
if (StringUtils.isNotNull(menuUrl) && StringUtils.isNotEmpty(menuUrl)) {
backlogInfo.setMenuUrl(menuUrl);
}
if (StringUtils.isNotNull(appUrl) && StringUtils.isNotEmpty(appUrl)) {
backlogInfo.setAppUrl(appUrl);
}
if (StringUtils.isNotNull(updateBy) && StringUtils.isNotEmpty(updateBy)) {
backlogInfo.setUpdateBy(updateBy);
}
backlogInfo.setUpdateTime(DateUtils.getNowDate());
return backlogInfoMapper.updateBacklogInfo(backlogInfo);
}
@Override
public int updateBacklogInfoByPid(String pid, String nodeId, String status, String updateBy, String menuUrl, String appUrl) {
BacklogInfo backlogInfo = new BacklogInfo();
if (StringUtils.isNotNull(pid) && StringUtils.isNotEmpty(pid)) {
backlogInfo.setPid(pid);
}
if (StringUtils.isNotNull(nodeId) && StringUtils.isNotEmpty(nodeId)) {
backlogInfo.setNodeId(nodeId);
}
if (StringUtils.isNotNull(status) && StringUtils.isNotEmpty(status)) {
backlogInfo.setStatus(status);
}
if (StringUtils.isNotNull(menuUrl) && StringUtils.isNotEmpty(menuUrl)) {
backlogInfo.setMenuUrl(menuUrl);
}
if (StringUtils.isNotNull(appUrl) && StringUtils.isNotEmpty(appUrl)) {
backlogInfo.setAppUrl(appUrl);
}
if (StringUtils.isNotNull(updateBy) && StringUtils.isNotEmpty(updateBy)) {
backlogInfo.setUpdateBy(updateBy);
}
backlogInfo.setUpdateTime(DateUtils.getNowDate());
return backlogInfoMapper.updateBacklogInfoByPid(backlogInfo);
}
}
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -8,6 +9,7 @@ import com.ruoyi.system.mapper.MessageInfoMapper; ...@@ -8,6 +9,7 @@ import com.ruoyi.system.mapper.MessageInfoMapper;
import com.ruoyi.system.domain.MessageInfo; import com.ruoyi.system.domain.MessageInfo;
import com.ruoyi.system.service.IMessageInfoService; import com.ruoyi.system.service.IMessageInfoService;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
/** /**
* 消息信息Service业务层处理 * 消息信息Service业务层处理
* *
...@@ -15,8 +17,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl; ...@@ -15,8 +17,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
* @date 2024-01-09 * @date 2024-01-09
*/ */
@Service @Service
public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper, MessageInfo> implements IMessageInfoService public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper, MessageInfo> implements IMessageInfoService {
{
@Autowired @Autowired
private MessageInfoMapper messageInfoMapper; private MessageInfoMapper messageInfoMapper;
...@@ -27,8 +28,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper ...@@ -27,8 +28,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper
* @return 消息信息 * @return 消息信息
*/ */
@Override @Override
public MessageInfo selectMessageInfoById(String id) public MessageInfo selectMessageInfoById(String id) {
{
return messageInfoMapper.selectMessageInfoById(id); return messageInfoMapper.selectMessageInfoById(id);
} }
...@@ -39,11 +39,27 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper ...@@ -39,11 +39,27 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper
* @return 消息信息 * @return 消息信息
*/ */
@Override @Override
public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo) public List<MessageInfo> selectMessageInfoList(MessageInfo messageInfo) {
{
return messageInfoMapper.selectMessageInfoList(messageInfo); return messageInfoMapper.selectMessageInfoList(messageInfo);
} }
/**
* 查询消息未读信息数量
*/
@Override
public int selectUnReadCount(String loginName) {
return messageInfoMapper.selectUnReadCount(loginName);
}
/**
* 清除未读
*/
@Override
public boolean updateChangeStatus(String loginName) {
return messageInfoMapper.updateChangeStatus(loginName);
}
/** /**
* 新增消息信息 * 新增消息信息
* *
...@@ -51,8 +67,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper ...@@ -51,8 +67,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertMessageInfo(MessageInfo messageInfo) public int insertMessageInfo(MessageInfo messageInfo) {
{
messageInfo.setCreateTime(DateUtils.getNowDate()); messageInfo.setCreateTime(DateUtils.getNowDate());
return messageInfoMapper.insertMessageInfo(messageInfo); return messageInfoMapper.insertMessageInfo(messageInfo);
} }
...@@ -64,8 +79,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper ...@@ -64,8 +79,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateMessageInfo(MessageInfo messageInfo) public int updateMessageInfo(MessageInfo messageInfo) {
{
messageInfo.setUpdateTime(DateUtils.getNowDate()); messageInfo.setUpdateTime(DateUtils.getNowDate());
return messageInfoMapper.updateMessageInfo(messageInfo); return messageInfoMapper.updateMessageInfo(messageInfo);
} }
...@@ -77,8 +91,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper ...@@ -77,8 +91,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteMessageInfoByIds(String[] ids) public int deleteMessageInfoByIds(String[] ids) {
{
return messageInfoMapper.deleteMessageInfoByIds(ids); return messageInfoMapper.deleteMessageInfoByIds(ids);
} }
...@@ -89,8 +102,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper ...@@ -89,8 +102,7 @@ public class MessageInfoServiceImpl extends MPJBaseServiceImpl<MessageInfoMapper
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteMessageInfoById(String id) public int deleteMessageInfoById(String id) {
{
return messageInfoMapper.deleteMessageInfoById(id); return messageInfoMapper.deleteMessageInfoById(id);
} }
} }
...@@ -64,6 +64,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -64,6 +64,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by a.status asc, a.create_time desc order by a.status asc, a.create_time desc
</select> </select>
<select id="selectUnReadCount" parameterType="String" resultType="java.lang.Integer">
select count(0)
from message_info
where `status` = '0'
and message_by = #{loginName}
</select>
<select id="selectMessageInfoById" parameterType="String" resultMap="MessageInfoResult"> <select id="selectMessageInfoById" parameterType="String" resultMap="MessageInfoResult">
<include refid="selectMessageInfoVo"/> <include refid="selectMessageInfoVo"/>
where id = #{id} where id = #{id}
...@@ -128,6 +135,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -128,6 +135,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</update> </update>
<update id="updateChangeStatus" parameterType="String">
update message_info
set `status` = '1'
where `status` = '0'
and message_by = #{loginName}
</update>
<delete id="deleteMessageInfoById" parameterType="String"> <delete id="deleteMessageInfoById" parameterType="String">
delete from message_info where id = #{id} delete from message_info where id = #{id}
</delete> </delete>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment