|
|
|
@ -4,6 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|
|
|
|
import com.hnac.hzims.message.dto.PushDto; |
|
|
|
|
import com.hnac.hzims.message.entity.MessagePushRecordEntity; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
|
import static com.hnac.hzims.message.MessageConstants.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @author hx |
|
|
|
@ -19,4 +24,25 @@ public interface IMessageService {
|
|
|
|
|
|
|
|
|
|
boolean send(MessagePushRecordEntity request); |
|
|
|
|
|
|
|
|
|
/** @Author hx |
|
|
|
|
* @Description 根据消息接受人获取推送账号 |
|
|
|
|
* @Date 2023/4/14 15:09 |
|
|
|
|
* @Param pusher 消息接收人 |
|
|
|
|
* @return |
|
|
|
|
**/ |
|
|
|
|
default String getAccountByPusher(Long pusher,String type) { |
|
|
|
|
User user = UserCache.getUser(pusher); |
|
|
|
|
if(ObjectUtil.isNotEmpty(user)) { |
|
|
|
|
switch(type) { |
|
|
|
|
case MAIL_PUSH: |
|
|
|
|
return Func.isNotEmpty(user.getEmail()) ? user.getEmail() : Long.toString(pusher); |
|
|
|
|
case SMS_PUSH: |
|
|
|
|
return Func.isNotEmpty(user.getPhone()) ? user.getPhone() : Long.toString(pusher); |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Long.toString(pusher); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|