zhitong.yu
2024-06-19 890cb68586fe79d95b37ee0ad78df0d9f7dce796
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
package com.hxzk;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hxzk.pojo.TbHeartRecord;
import com.hxzk.util.ChuangLanSmsUtil;
import com.hxzk.util.SmsSendRequest;
import com.hxzk.util.SmsSendResponse;
 
import java.awt.geom.Point2D;
import java.util.ArrayList;
import java.util.List;
 
public class Main {
 
    public static void main(String[] args) {
        final String charset = "utf-8";
        String account = "N0372377";
        String password = "ERMHxL4yQx9a50";
 
        String smsSingleRequestServerUrl = "http://smssh1.253.com/msg/send/json";
        String msg = "车辆安全报警,车牌:鲁AN9F09,时间:2023-09-09 20:56,位置:北纬39.809272,东经116.92023,触发报警:熄火制动,司机:张三,手机号:13952677195,请及时处理。";
        String phone = "17531353238";
        String report= "true";
        JSONObject json=new JSONObject();
        json.put("account",account);
        json.put("password",password);
        json.put("msg",msg);
        json.put("phone",phone);
        json.put("report",report);
 
        SmsSendRequest smsSingleRequest = new SmsSendRequest(account, password, msg, phone,report);
        String requestJson = JSON.toJSONString(smsSingleRequest);
        System.out.println("before request string is: " + requestJson);
        String response = ChuangLanSmsUtil.sendSmsByPost(smsSingleRequestServerUrl, json.toString());
        System.out.println("response after request result is :" + response);
        SmsSendResponse smsSingleResponse = JSON.parseObject(response, SmsSendResponse.class);
        System.out.println("response  toString is :" + smsSingleResponse);
    }
}