sinake
12 小时以前 02e4e3a9fcfbe2a366fc75868dfa019145cea9d2
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
package com.ruoyi.common.utils.sms;
 
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.utils.HttpUtil;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.sign.Md5Utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
 
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
 
@Slf4j
public class smsUtils {
 
 
    /**
     * 杭州市一医院吴山院区我短信接口
     *
     * @param url      短信URL
     * @param userName 短信帐号
     * @param content  短信密码
     * @param phone    手机号组合如 13500000001,13500000002
     * @param content  短信内容
     * @return 两个参数的和
     */
    public static String sendSms(String url, String userName, String passWord, String phone, String content) {
        long timestamp = new Date().getTime();
        String sign = Md5Utils.hash(userName + timestamp + Md5Utils.hash(passWord));
        content = "【杭州市一医院吴山院区】" + content;
        String jsonMsg = "{" +
                "\"userName\": \"" + userName + "\"," +
                "\"content\": \"" + content + "\"," +
                "\"phoneList\": [" + phone + "]," +
                "\"timestamp\": " + timestamp + "," +
                "\"sign\": \"" + sign + "\"" +
                "}";
        String sendMsg=HttpUtil.postJsonRequest(url, jsonMsg);
        return sendMsg;
 
    }
 
    /**
     * 杭州市一医院吴山院区我短信接口
     *
     * @param url      微信URL
     * @param phone    手机号 13500000001
     * @param idCard  身份证
     * @return 两个参数的和
     */
    public static String sendChat(String url,String phone,String idCard){
        String urlTemp = "http://192.200.54.14:5003/sfjk/SendMessage?sfzh="
                + idCard
                + "&title=您好,邀请您填写出院调查表,请点击填写。&content=待随访&phone=" + phone
                + "&url=" + url + "&key=ff76f8904f5f32b5ee1739e8ea46e60g";
        String sendMsg = "";
        try {
            sendMsg = HttpUtils.sendPost(urlTemp);
            log.info(sendMsg);
        } catch (Exception ex) {
            sendMsg=ex.getMessage();
            log.error(ex.getMessage());
        }
        return  sendMsg;
    }
}