package com.ruoyi.message.sms.provider.sltd; import com.ruoyi.message.MessageChannel; import com.ruoyi.message.SendResult; import com.ruoyi.message.sms.AbstractSmsSender; import com.ruoyi.message.sms.SmsSendRequest; import com.ruoyi.message.sms.provider.sltd.ws.MessageSend; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; /** * 省立同德短信发送方({@code sltd} 通道)。 *
* 对接特征:JAX-WS SOAP 网关({@code i5GSend}),短信类型固定 {@code 6}(内容含链接和电话), * 成功判定见 {@link SltdResponseParser}。 * 代码来源:{@code RyTask.sltd 分支} + {@code RedisMqReceiver.sltd 分支}(行为保持不变)。 */ @Slf4j @Component public class SltdSmsSender extends AbstractSmsSender { /** * 渠道 key,与 {@code spring.profiles.active=sltd} 对应 */ public static final String KEY = "sltd"; /** * 短信类型:内容有链接和电话 */ private static final String MESSAGE_TYPE_SMS = "6"; @Override public String key() { return KEY; } @Override public String description() { return "省立同德短信(SOAP i5GSend,类型6)"; } @Override protected SendResult doSend(SmsSendRequest request) { String raw = MessageSend.sendMsg( request.getContent(), MESSAGE_TYPE_SMS, request.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); log.info("【{}】省立同德短信发送返回:{}", KEY, raw); String code = SltdResponseParser.resultValue(raw); if (SltdResponseParser.isSuccess(raw)) { return SendResult.success(KEY, MessageChannel.SMS, raw).withCode(code); } return SendResult.fail(KEY, MessageChannel.SMS, "短信发送失败", raw).withCode(code); } }