Pārlūkot izejas kodu

code review 站内信代码

YunaiV 2 gadi atpakaļ
vecāks
revīzija
491921d5ae

+ 2 - 0
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 {
      * 内容
      */
     private String content;
+    // TODO @luowenfeng:是不是创建时间,直接作为发送时间;
     /**
      * 发送时间
      */
     private Date sendTime;
+    // TODO @luowenfeng:是不是不用发送 id 和名字😑?
     /**
      * 发送用户id
      */

+ 2 - 2
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
 import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
 
 /**
- * <p>
  * 站内信日志 Service 接口
- * </p>
  *
  * @author LuoWenFeng
  */
 public interface NotifyLogService {
 
+    // TODO @LuoWenFeng:NotifyLogService=》NotifyMessageService
 
     /**
      * 获得站内信发送分页
@@ -21,4 +20,5 @@ public interface NotifyLogService {
      * @return 站内信分页
      */
     PageResult<NotifyMessageDO> getNotifyMessageSendPage(NotifyLogPageReqVO pageReqVO);
+
 }

+ 4 - 2
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 {
         }
     }
 
-
     /**
      * 批量修改阅读状态为已读
-     * @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));
     }
+
 }

+ 3 - 2
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
 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());

+ 0 - 1
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 {
         notifyTemplateCache = CollectionUtils.convertMap(notifyTemplateList, NotifyTemplateDO::getCode);
         maxUpdateTime = CollectionUtils.getMaxValue(notifyTemplateList, NotifyTemplateDO::getUpdateTime);
         log.info("[initLocalCache][初始化 NotifyTemplate 数量为 {}]", notifyTemplateList.size());
-
     }
 
     /**