Search in sources :

Example 1 with QuerySendDetailsRequest

use of com.aliyun.dysmsapi20170525.models.QuerySendDetailsRequest in project eladmin by lWoHvYe.

the class DySMSUtil method querySendDetails.

/**
 * 查询结果
 *
 * @param phoneNumbers
 * @param bizId
 * @date 2021/11/7 12:52 下午
 */
@SneakyThrows
public static void querySendDetails(@NotNull String phoneNumbers, String bizId) {
    Client client = DySMSUtil.createClient();
    // 3.查询结果
    for (String phoneNum : phoneNumbers.split(",")) {
        QuerySendDetailsRequest queryReq = new QuerySendDetailsRequest().setPhoneNumber(phoneNum.trim()).setBizId(bizId).setSendDate(DateUtil.today()).setPageSize(10L).setCurrentPage(1L);
        QuerySendDetailsResponse queryResp = client.querySendDetails(queryReq);
        var dtos = queryResp.body.smsSendDetailDTOs.smsSendDetailDTO;
        // 打印结果
        for (var dto : dtos) {
            if (ObjectUtil.equals(dto.sendStatus, 3L)) {
                log.info(" {} 发送成功,接收时间: {} ", dto.phoneNum, dto.receiveDate);
            } else if (ObjectUtil.equals(dto.sendStatus, 2L)) {
                log.info(" {} 发送失败", dto.phoneNum);
            } else {
                log.info(" {} 正在发送中...", dto.phoneNum);
            }
        }
    }
}
Also used : QuerySendDetailsResponse(com.aliyun.dysmsapi20170525.models.QuerySendDetailsResponse) QuerySendDetailsRequest(com.aliyun.dysmsapi20170525.models.QuerySendDetailsRequest) Client(com.aliyun.dysmsapi20170525.Client) SneakyThrows(lombok.SneakyThrows)

Aggregations

Client (com.aliyun.dysmsapi20170525.Client)1 QuerySendDetailsRequest (com.aliyun.dysmsapi20170525.models.QuerySendDetailsRequest)1 QuerySendDetailsResponse (com.aliyun.dysmsapi20170525.models.QuerySendDetailsResponse)1 SneakyThrows (lombok.SneakyThrows)1