liusheng
5 天以前 0c621621889c90a119e2ff9e41c4f5528f395f7e
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package com.smartor.service.impl;
 
import WebServiceClient.MessagingInsertLocator;
import WebServiceClient.MessagingInsertSoap12Stub;
import com.ruoyi.common.utils.DateUtils;
import com.smartor.domain.SmsParam;
import com.smartor.mapper.SmsParamMapper;
import com.smartor.service.ISmsParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import javax.xml.rpc.holders.IntHolder;
import java.rmi.RemoteException;
import java.util.Date;
import java.util.List;
 
/**
 * 短信参数Service业务层处理
 *
 * @author smartor
 * @date 2023-03-06
 */
@Service
public class SmsParamServiceImpl implements ISmsParamService {
    @Autowired
    private SmsParamMapper smsParamMapper;
 
    /**
     * 查询短信参数
     *
     * @param paramid 短信参数主键
     * @return 短信参数
     */
    @Override
    public SmsParam selectSmsParamByParamid(Long paramid) {
        return smsParamMapper.selectSmsParamByParamid(paramid);
    }
 
    /**
     * 查询短信参数列表
     *
     * @param smsParam 短信参数
     * @return 短信参数
     */
    @Override
    public List<SmsParam> selectSmsParamList(SmsParam smsParam) {
        return smsParamMapper.selectSmsParamList(smsParam);
    }
 
    /**
     * 新增短信参数
     *
     * @param smsParam 短信参数
     * @return 结果
     */
    @Override
    public int insertSmsParam(SmsParam smsParam) {
        smsParam.setCreateTime(DateUtils.getNowDate());
        return smsParamMapper.insertSmsParam(smsParam);
    }
 
 
    /**
     * 修改短信参数
     *
     * @param smsParam 短信参数
     * @return 结果
     */
    @Override
    public int updateSmsParam(SmsParam smsParam) {
        smsParam.setUpdateTime(DateUtils.getNowDate());
        return smsParamMapper.updateSmsParam(smsParam);
    }
 
    /**
     * 批量删除短信参数
     *
     * @param paramids 需要删除的短信参数主键
     * @return 结果
     */
    @Override
    public int deleteSmsParamByParamids(Long[] paramids) {
        return smsParamMapper.deleteSmsParamByParamids(paramids);
    }
 
    /**
     * 删除短信参数信息
     *
     * @param paramid 短信参数主键
     * @return 结果
     */
    @Override
    public int deleteSmsParamByParamid(Long paramid) {
        return smsParamMapper.deleteSmsParamByParamid(paramid);
    }
 
    @Override
    public int sendSmsInfo(String info, String phone) {
        MessagingInsertSoap12Stub binding = null;
        try {
            binding = (MessagingInsertSoap12Stub) new MessagingInsertLocator().getMessagingInsertSoap12();
        } catch (Exception e) {
            e.printStackTrace();
        }
        String aa = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + "<Request>\n" + "<operate>S001</operate>\n" + "<Sheets>\n" + "<Sheet>\n" + "<Content>" + info + "</Content>\n" + "<Mobile>" + phone + "</Mobile>\n" + "<DateTime>" + new Date() + "</DateTime>\n" + "<Type>预约挂号</Type>\n" + "</Sheet>\n" + "</Sheets>\n" + "</Request>";
        Integer integer = null;
        try {
            integer = binding.SMSMessageAccept(aa, new IntHolder(), new javax.xml.rpc.holders.StringHolder());
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return integer;
    }
}