liusheng
2026-10-10 0afac42fb2e9d6e5291304dd0044ce3042b45d2b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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} 通道)。
 * <p>
 * 对接特征: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);
    }
}