|
|
@ -15,6 +15,7 @@ import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.sms.model.SmsResponse; |
|
|
|
import org.springblade.core.sms.model.SmsResponse; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
import org.springblade.resource.feign.ISmsClient; |
|
|
|
import org.springblade.resource.feign.ISmsClient; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
@ -48,11 +49,15 @@ public class SmsMessageServiceImpl implements IMessageService { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean send(MessagePushRecordEntity request) { |
|
|
|
public boolean send(MessagePushRecordEntity request) { |
|
|
|
|
|
|
|
String account = this.getAccountByPusher(Long.parseLong(request.getPusher()), request.getType()); |
|
|
|
|
|
|
|
Assert.isTrue(Func.isNotEmpty(account) && StringUtil.isNotBlank(account) ,() -> { |
|
|
|
|
|
|
|
throw new ServiceException("未查询到相关用户,短信推送失败!"); |
|
|
|
|
|
|
|
}); |
|
|
|
R<SmsResponse> response = smsClient.sendMessage( |
|
|
|
R<SmsResponse> response = smsClient.sendMessage( |
|
|
|
Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId(), |
|
|
|
Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId(), |
|
|
|
request.getResourceCode(), |
|
|
|
request.getResourceCode(), |
|
|
|
request.getSmsParam(), |
|
|
|
request.getSmsParam(), |
|
|
|
this.getAccountByPusher(Long.parseLong(request.getPusher()),request.getType()) |
|
|
|
account |
|
|
|
); |
|
|
|
); |
|
|
|
if(ObjectUtils.isEmpty(response.getData())) { |
|
|
|
if(ObjectUtils.isEmpty(response.getData())) { |
|
|
|
Assert.isTrue(response.isSuccess(), () -> { |
|
|
|
Assert.isTrue(response.isSuccess(), () -> { |
|
|
@ -68,11 +73,15 @@ public class SmsMessageServiceImpl implements IMessageService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public R sendSmsByRecord(MessagePushRecordEntity request) { |
|
|
|
public R sendSmsByRecord(MessagePushRecordEntity request) { |
|
|
|
return smsClient.sendMessage( |
|
|
|
String account = this.getAccountByPusher(Long.parseLong(request.getPusher()), request.getType()); |
|
|
|
Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId(), |
|
|
|
if(Func.isNotEmpty(account) && StringUtil.isNotBlank(account)) { |
|
|
|
request.getResourceCode(), |
|
|
|
return smsClient.sendMessage( |
|
|
|
request.getSmsParam(), |
|
|
|
Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId(), |
|
|
|
this.getAccountByPusher(Long.parseLong(request.getPusher()),request.getType()) |
|
|
|
request.getResourceCode(), |
|
|
|
); |
|
|
|
request.getSmsParam(), |
|
|
|
|
|
|
|
account |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return R.fail("未查询到相关用户,短信推送失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|