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; } }