code review 站内信代码

This commit is contained in:
YunaiV 2022-12-23 18:41:41 +08:00
parent 5cac636f32
commit 491921d5ae
5 changed files with 11 additions and 7 deletions

View File

@ -61,10 +61,12 @@ public class NotifyMessageDO extends BaseDO {
* 内容
*/
private String content;
// TODO @luowenfeng是不是创建时间直接作为发送时间
/**
* 发送时间
*/
private Date sendTime;
// TODO @luowenfeng是不是不用发送 id 和名字😑
/**
* 发送用户id
*/

View File

@ -5,14 +5,13 @@ import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogPa
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
/**
* <p>
* 站内信日志 Service 接口
* </p>
*
* @author LuoWenFeng
*/
public interface NotifyLogService {
// TODO @LuoWenFengNotifyLogService=NotifyMessageService
/**
* 获得站内信发送分页
@ -21,4 +20,5 @@ public interface NotifyLogService {
* @return 站内信分页
*/
PageResult<NotifyMessageDO> getNotifyMessageSendPage(NotifyLogPageReqVO pageReqVO);
}

View File

@ -163,15 +163,17 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
}
}
/**
* 批量修改阅读状态为已读
* @param ids
*
* @param ids 站内变编号数组
*/
private void batchUpdateReadStatus(Collection<Long> ids) {
NotifyMessageDO updateObj = new NotifyMessageDO();
updateObj.setReadStatus(true);
updateObj.setReadTime(new Date());
// TODO @luowenfeng涉及到 mybatis 的操作都要隐藏到 mapper
notifyMessageMapper.update(updateObj, new LambdaQueryWrapperX<NotifyMessageDO>().in(NotifyMessageDO::getId, ids));
}
}

View File

@ -19,6 +19,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND;
// TODO @luowenfeng可以直接合并到 NotifyMessageService 之前 sms 台复杂所以没合并
/**
* 站内信发送 Service 实现类
*
@ -40,7 +41,6 @@ public class NotifySendServiceImpl implements NotifySendService {
@Override
public Long sendSingleNotifyToAdmin(Long userId, String templateCode, Map<String, Object> templateParams) {
return sendSingleNotify(userId, UserTypeEnum.ADMIN.getValue(), templateCode, templateParams);
}
@ -54,9 +54,10 @@ public class NotifySendServiceImpl implements NotifySendService {
// 校验短信模板是否合法
NotifyTemplateDO template = this.checkNotifyTemplateValid(templateCode);
String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams);
// 获得用户
AdminUserDO sendUser = userService.getUser(getLoginUserId());
// todo 模板状态未开启时的业务
// todo 模板状态未开启时的业务如果未开启就直接 return 好了
NotifyMessageDO notifyMessageDO = new NotifyMessageDO();
notifyMessageDO.setContent(content);
notifyMessageDO.setTitle(template.getTitle());

View File

@ -85,7 +85,6 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService {
notifyTemplateCache = CollectionUtils.convertMap(notifyTemplateList, NotifyTemplateDO::getCode);
maxUpdateTime = CollectionUtils.getMaxValue(notifyTemplateList, NotifyTemplateDO::getUpdateTime);
log.info("[initLocalCache][初始化 NotifyTemplate 数量为 {}]", notifyTemplateList.size());
}
/**