修改通知

This commit is contained in:
wanggeng888 2021-03-31 21:40:04 +08:00
parent 21d1f1647f
commit aa038fd207
5 changed files with 265 additions and 1 deletions

View File

@ -49,7 +49,7 @@ public class MessageResourceController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("noticewithtarget/save")
@CheckRequestBodyAnnotation
public SuccessResult saveNoticeWithTargetAndSave(@RequestBody NoticeVO noticeVO) throws Exception {
public synchronized SuccessResult saveNoticeWithTargetAndSave(@RequestBody NoticeVO noticeVO) throws Exception {
return messageService.saveNoticeWithTarget(noticeVO, true);
}

View File

@ -38,6 +38,15 @@ public interface INoticeDao {
*/
void updateHandle(Map<String, Object> params) throws UpdateException;
/**
* 详情
*
* @param params
* @return
* @throws SearchException
*/
NoticePO getPO(Map<String, Object> params) throws SearchException;
/**
* 列表
*
@ -82,4 +91,5 @@ public interface INoticeDao {
* @throws SearchException
*/
Integer count(Map<String, Object> params) throws SearchException;
}

View File

@ -1,6 +1,7 @@
package com.cm.websocket.service;
import com.cm.websocket.pojo.AppSocketMessage;
import com.cm.websocket.pojo.pos.NoticePO;
import com.cm.websocket.pojo.vos.message.NoticeVO;
import java.util.List;
@ -35,6 +36,106 @@ public interface INoticeService {
*/
void updateHandleStatus(String userId, AppSocketMessage.CountNeedToDealWithBody countNeedToDealWithBody);
/**
* 通知详情
*
* @param params
* @return
*/
NoticePO getPO(Map<String, Object> params);
/**
* 通知详情
*
* @param serviceId
* @param userId
* @return
*/
NoticePO getPO(String serviceId, String userId);
/**
* 通知详情
*
* @param system
* @param serviceId
* @param userId
* @return
*/
NoticePO getPO(String system, String serviceId, String userId);
/**
* 通知详情
*
* @param system
* @param module
* @param serviceId
* @param userId
* @return
*/
NoticePO getPO(String system, String module, String serviceId, String userId);
/**
* 通知详情
*
* @param system
* @param module
* @param menu
* @param serviceId
* @param userId
* @return
*/
NoticePO getPO(String system, String module, String menu, String serviceId, String userId);
/**
* 通知列表
*
* @param params
* @return
*/
List<NoticePO> listPO(Map<String, Object> params);
/**
* 通知列表
*
* @param serviceId
* @param userId
* @return
*/
List<NoticePO> listPO(String serviceId, String userId);
/**
* 通知列表
*
* @param system
* @param serviceId
* @param userId
* @return
*/
List<NoticePO> listPO(String system, String serviceId, String userId);
/**
* 通知列表
*
* @param system
* @param module
* @param serviceId
* @param userId
* @return
*/
List<NoticePO> listPO(String system, String module, String serviceId, String userId);
/**
* 通知列表
*
* @param system
* @param module
* @param menu
* @param serviceId
* @param userId
* @return
*/
List<NoticePO> listPO(String system, String module, String menu, String serviceId, String userId);
/**
* 通知数量
*

View File

@ -4,6 +4,7 @@ import com.cm.common.base.AbstractService;
import com.cm.common.utils.UUIDUtil;
import com.cm.websocket.dao.INoticeDao;
import com.cm.websocket.pojo.AppSocketMessage;
import com.cm.websocket.pojo.pos.NoticePO;
import com.cm.websocket.pojo.vos.message.NoticeVO;
import com.cm.websocket.service.INoticeService;
import org.apache.commons.lang3.StringUtils;
@ -32,6 +33,20 @@ public class NoticeServiceImpl extends AbstractService implements INoticeService
@Override
public void save(String userId, NoticeVO.Notice notice) throws Exception {
if (StringUtils.isBlank(userId)) {
return;
}
if (StringUtils.isBlank(notice.getSystem())) {
return;
}
if (StringUtils.isBlank(notice.getServiceId())) {
return;
}
List<NoticePO> noticePOs = listPO(notice.getSystem(), notice.getModule(), notice.getMenu(), notice.getServiceId(), userId);
if (!noticePOs.isEmpty()) {
LOG.debug("通知已经存在");
return;
}
Map<String, Object> params = getHashMap(16);
params.put("noticeId", UUIDUtil.getUUID());
params.put("userId", userId);
@ -63,6 +78,92 @@ public class NoticeServiceImpl extends AbstractService implements INoticeService
noticeDao.updateHandle(params);
}
@Override
public NoticePO getPO(Map<String, Object> params) {
return noticeDao.getPO(params);
}
@Override
public NoticePO getPO(String serviceId, String userId) {
Map<String, Object> params = getHashMap(4);
params.put("noticeServiceId", serviceId);
params.put("userId", userId);
return getPO(params);
}
@Override
public NoticePO getPO(String system, String serviceId, String userId) {
Map<String, Object> params = getHashMap(6);
params.put("noticeSystem", system);
params.put("noticeServiceId", serviceId);
params.put("userId", userId);
return getPO(params);
}
@Override
public NoticePO getPO(String system, String module, String serviceId, String userId) {
Map<String, Object> params = getHashMap(8);
params.put("noticeSystem", system);
params.put("noticeModule", module);
params.put("noticeServiceId", serviceId);
params.put("userId", userId);
return getPO(params);
}
@Override
public NoticePO getPO(String system, String module, String menu, String serviceId, String userId) {
Map<String, Object> params = getHashMap(10);
params.put("noticeSystem", system);
params.put("noticeModule", module);
params.put("noticeMenu", menu);
params.put("noticeServiceId", serviceId);
params.put("userId", userId);
return getPO(params);
}
@Override
public List<NoticePO> listPO(Map<String, Object> params) {
return noticeDao.listPO(params);
}
@Override
public List<NoticePO> listPO(String serviceId, String userId) {
Map<String, Object> params = getHashMap(4);
params.put("noticeServiceId", serviceId);
params.put("userId", userId);
return listPO(params);
}
@Override
public List<NoticePO> listPO(String system, String serviceId, String userId) {
Map<String, Object> params = getHashMap(6);
params.put("noticeSystem", system);
params.put("noticeServiceId", serviceId);
params.put("userId", userId);
return listPO(params);
}
@Override
public List<NoticePO> listPO(String system, String module, String serviceId, String userId) {
Map<String, Object> params = getHashMap(8);
params.put("noticeSystem", system);
params.put("noticeModule", module);
params.put("noticeServiceId", serviceId);
params.put("userId", userId);
return listPO(params);
}
@Override
public List<NoticePO> listPO(String system, String module, String menu, String serviceId, String userId) {
Map<String, Object> params = getHashMap(10);
params.put("noticeSystem", system);
params.put("noticeModule", module);
params.put("noticeMenu", menu);
params.put("noticeServiceId", serviceId);
params.put("userId", userId);
return listPO(params);
}
@Override
public List<AppSocketMessage.CountNeedToDealWithBody> listNoticeCount(String userId, AppSocketMessage.CountNeedToDealWithBody countNeedToDealWithBody) {
List<AppSocketMessage.CountNeedToDealWithBody> noticeCounts = new ArrayList<>();

View File

@ -72,6 +72,54 @@
notice_service_id = #{noticeServiceId}
</update>
<!-- 详情 -->
<select id="getPO" parameterType="map" resultMap="noticePO">
SELECT
notice_id,
notice_title,
notice_msg,
notice_target,
notice_system,
notice_module,
notice_menu,
notice_service_id,
user_id,
is_handle,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
FROM
socket_notice
WHERE
is_delete = 0
<if test="noticeId != null and noticeId != ''">
AND
notice_id = #{noticeId}
</if>
<if test="noticeSystem != null and noticeSystem != ''">
AND
notice_system = #{noticeSystem}
</if>
<if test="noticeModule != null and noticeModule != ''">
AND
notice_module = #{noticeModule}
</if>
<if test="noticeMenu != null and noticeMenu">
AND
notice_menu = #{noticeMenu}
</if>
<if test="noticeServiceId != null and noticeServiceId != ''">
AND
notice_service_id = #{noticeServiceId}
</if>
<if test="userId != null and userId != ''">
AND
user_id = #{userId}
</if>
</select>
<!-- 列表 -->
<select id="listPO" parameterType="map" resultMap="noticePO">
SELECT
@ -106,6 +154,10 @@
AND
notice_menu = #{noticeMenu}
</if>
<if test="noticeServiceId != null and noticeServiceId != ''">
AND
notice_service_id = #{noticeServiceId}
</if>
<if test="userId != null and userId != ''">
AND
user_id = #{userId}