mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 04:08:43 +08:00 
			
		
		
		
	code review 站内信代码
This commit is contained in:
		@@ -61,10 +61,12 @@ public class NotifyMessageDO extends BaseDO {
 | 
			
		||||
     * 内容
 | 
			
		||||
     */
 | 
			
		||||
    private String content;
 | 
			
		||||
    // TODO @luowenfeng:是不是创建时间,直接作为发送时间;
 | 
			
		||||
    /**
 | 
			
		||||
     * 发送时间
 | 
			
		||||
     */
 | 
			
		||||
    private Date sendTime;
 | 
			
		||||
    // TODO @luowenfeng:是不是不用发送 id 和名字😑?
 | 
			
		||||
    /**
 | 
			
		||||
     * 发送用户id
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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());
 | 
			
		||||
 
 | 
			
		||||
@@ -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());
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user