code review 站内信代码

pull/2/head
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; private String content;
// TODO @luowenfeng是不是创建时间直接作为发送时间
/** /**
* *
*/ */
private Date sendTime; private Date sendTime;
// TODO @luowenfeng是不是不用发送 id 和名字😑?
/** /**
* 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; import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
/** /**
* <p>
* Service * Service
* </p>
* *
* @author LuoWenFeng * @author LuoWenFeng
*/ */
public interface NotifyLogService { public interface NotifyLogService {
// TODO @LuoWenFengNotifyLogService=》NotifyMessageService
/** /**
* *
@ -21,4 +20,5 @@ public interface NotifyLogService {
* @return * @return
*/ */
PageResult<NotifyMessageDO> getNotifyMessageSendPage(NotifyLogPageReqVO pageReqVO); 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) { private void batchUpdateReadStatus(Collection<Long> ids) {
NotifyMessageDO updateObj = new NotifyMessageDO(); NotifyMessageDO updateObj = new NotifyMessageDO();
updateObj.setReadStatus(true); updateObj.setReadStatus(true);
updateObj.setReadTime(new Date()); updateObj.setReadTime(new Date());
// TODO @luowenfeng涉及到 mybatis 的操作,都要隐藏到 mapper 中;
notifyMessageMapper.update(updateObj, new LambdaQueryWrapperX<NotifyMessageDO>().in(NotifyMessageDO::getId, ids)); 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.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND;
// TODO @luowenfeng可以直接合并到 NotifyMessageService 中;之前 sms 台复杂,所以没合并。
/** /**
* Service * Service
* *
@ -40,7 +41,6 @@ public class NotifySendServiceImpl implements NotifySendService {
@Override @Override
public Long sendSingleNotifyToAdmin(Long userId, String templateCode, Map<String, Object> templateParams) { public Long sendSingleNotifyToAdmin(Long userId, String templateCode, Map<String, Object> templateParams) {
return sendSingleNotify(userId, UserTypeEnum.ADMIN.getValue(), templateCode, templateParams); return sendSingleNotify(userId, UserTypeEnum.ADMIN.getValue(), templateCode, templateParams);
} }
@ -54,9 +54,10 @@ public class NotifySendServiceImpl implements NotifySendService {
// 校验短信模板是否合法 // 校验短信模板是否合法
NotifyTemplateDO template = this.checkNotifyTemplateValid(templateCode); NotifyTemplateDO template = this.checkNotifyTemplateValid(templateCode);
String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams); String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams);
// 获得用户
AdminUserDO sendUser = userService.getUser(getLoginUserId()); AdminUserDO sendUser = userService.getUser(getLoginUserId());
// todo 模板状态未开启时的业务 // todo 模板状态未开启时的业务;如果未开启,就直接 return 好了;
NotifyMessageDO notifyMessageDO = new NotifyMessageDO(); NotifyMessageDO notifyMessageDO = new NotifyMessageDO();
notifyMessageDO.setContent(content); notifyMessageDO.setContent(content);
notifyMessageDO.setTitle(template.getTitle()); notifyMessageDO.setTitle(template.getTitle());

View File

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