Commit 491921d5aefd36470ef38682a0bfe2385d7823d6

Authored by YunaiV
1 parent 5cac636f

code review 站内信代码

yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/notify/NotifyMessageDO.java
@@ -61,10 +61,12 @@ public class NotifyMessageDO extends BaseDO { @@ -61,10 +61,12 @@ public class NotifyMessageDO extends BaseDO {
61 * 内容 61 * 内容
62 */ 62 */
63 private String content; 63 private String content;
  64 + // TODO @luowenfeng:是不是创建时间,直接作为发送时间;
64 /** 65 /**
65 * 发送时间 66 * 发送时间
66 */ 67 */
67 private Date sendTime; 68 private Date sendTime;
  69 + // TODO @luowenfeng:是不是不用发送 id 和名字😑?
68 /** 70 /**
69 * 发送用户id 71 * 发送用户id
70 */ 72 */
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyLogService.java
@@ -5,14 +5,13 @@ import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogPa @@ -5,14 +5,13 @@ import cn.iocoder.yudao.module.system.controller.admin.notify.vo.log.NotifyLogPa
5 import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; 5 import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
6 6
7 /** 7 /**
8 - * <p>  
9 * 站内信日志 Service 接口 8 * 站内信日志 Service 接口
10 - * </p>  
11 * 9 *
12 * @author LuoWenFeng 10 * @author LuoWenFeng
13 */ 11 */
14 public interface NotifyLogService { 12 public interface NotifyLogService {
15 13
  14 + // TODO @LuoWenFeng:NotifyLogService=》NotifyMessageService
16 15
17 /** 16 /**
18 * 获得站内信发送分页 17 * 获得站内信发送分页
@@ -21,4 +20,5 @@ public interface NotifyLogService { @@ -21,4 +20,5 @@ public interface NotifyLogService {
21 * @return 站内信分页 20 * @return 站内信分页
22 */ 21 */
23 PageResult<NotifyMessageDO> getNotifyMessageSendPage(NotifyLogPageReqVO pageReqVO); 22 PageResult<NotifyMessageDO> getNotifyMessageSendPage(NotifyLogPageReqVO pageReqVO);
  23 +
24 } 24 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java
@@ -163,15 +163,17 @@ public class NotifyMessageServiceImpl implements NotifyMessageService { @@ -163,15 +163,17 @@ public class NotifyMessageServiceImpl implements NotifyMessageService {
163 } 163 }
164 } 164 }
165 165
166 -  
167 /** 166 /**
168 * 批量修改阅读状态为已读 167 * 批量修改阅读状态为已读
169 - * @param ids 168 + *
  169 + * @param ids 站内变编号数组
170 */ 170 */
171 private void batchUpdateReadStatus(Collection<Long> ids) { 171 private void batchUpdateReadStatus(Collection<Long> ids) {
172 NotifyMessageDO updateObj = new NotifyMessageDO(); 172 NotifyMessageDO updateObj = new NotifyMessageDO();
173 updateObj.setReadStatus(true); 173 updateObj.setReadStatus(true);
174 updateObj.setReadTime(new Date()); 174 updateObj.setReadTime(new Date());
  175 + // TODO @luowenfeng:涉及到 mybatis 的操作,都要隐藏到 mapper 中;
175 notifyMessageMapper.update(updateObj, new LambdaQueryWrapperX<NotifyMessageDO>().in(NotifyMessageDO::getId, ids)); 176 notifyMessageMapper.update(updateObj, new LambdaQueryWrapperX<NotifyMessageDO>().in(NotifyMessageDO::getId, ids));
176 } 177 }
  178 +
177 } 179 }
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifySendServiceImpl.java
@@ -19,6 +19,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU @@ -19,6 +19,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
19 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; 19 import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
20 import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND; 20 import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND;
21 21
  22 +// TODO @luowenfeng:可以直接合并到 NotifyMessageService 中;之前 sms 台复杂,所以没合并。
22 /** 23 /**
23 * 站内信发送 Service 实现类 24 * 站内信发送 Service 实现类
24 * 25 *
@@ -40,7 +41,6 @@ public class NotifySendServiceImpl implements NotifySendService { @@ -40,7 +41,6 @@ public class NotifySendServiceImpl implements NotifySendService {
40 41
41 @Override 42 @Override
42 public Long sendSingleNotifyToAdmin(Long userId, String templateCode, Map<String, Object> templateParams) { 43 public Long sendSingleNotifyToAdmin(Long userId, String templateCode, Map<String, Object> templateParams) {
43 -  
44 return sendSingleNotify(userId, UserTypeEnum.ADMIN.getValue(), templateCode, templateParams); 44 return sendSingleNotify(userId, UserTypeEnum.ADMIN.getValue(), templateCode, templateParams);
45 } 45 }
46 46
@@ -54,9 +54,10 @@ public class NotifySendServiceImpl implements NotifySendService { @@ -54,9 +54,10 @@ public class NotifySendServiceImpl implements NotifySendService {
54 // 校验短信模板是否合法 54 // 校验短信模板是否合法
55 NotifyTemplateDO template = this.checkNotifyTemplateValid(templateCode); 55 NotifyTemplateDO template = this.checkNotifyTemplateValid(templateCode);
56 String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams); 56 String content = notifyTemplateService.formatNotifyTemplateContent(template.getContent(), templateParams);
  57 + // 获得用户
57 AdminUserDO sendUser = userService.getUser(getLoginUserId()); 58 AdminUserDO sendUser = userService.getUser(getLoginUserId());
58 59
59 - // todo 模板状态未开启时的业务 60 + // todo 模板状态未开启时的业务;如果未开启,就直接 return 好了;
60 NotifyMessageDO notifyMessageDO = new NotifyMessageDO(); 61 NotifyMessageDO notifyMessageDO = new NotifyMessageDO();
61 notifyMessageDO.setContent(content); 62 notifyMessageDO.setContent(content);
62 notifyMessageDO.setTitle(template.getTitle()); 63 notifyMessageDO.setTitle(template.getTitle());
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateServiceImpl.java
@@ -85,7 +85,6 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService { @@ -85,7 +85,6 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService {
85 notifyTemplateCache = CollectionUtils.convertMap(notifyTemplateList, NotifyTemplateDO::getCode); 85 notifyTemplateCache = CollectionUtils.convertMap(notifyTemplateList, NotifyTemplateDO::getCode);
86 maxUpdateTime = CollectionUtils.getMaxValue(notifyTemplateList, NotifyTemplateDO::getUpdateTime); 86 maxUpdateTime = CollectionUtils.getMaxValue(notifyTemplateList, NotifyTemplateDO::getUpdateTime);
87 log.info("[initLocalCache][初始化 NotifyTemplate 数量为 {}]", notifyTemplateList.size()); 87 log.info("[initLocalCache][初始化 NotifyTemplate 数量为 {}]", notifyTemplateList.size());
88 -  
89 } 88 }
90 89
91 /** 90 /**