|
@ -9,11 +9,15 @@ import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
|
|
|
import com.yihu.wlyy.service.third.guahao.GuahaoYihuService;
|
|
|
import com.yihu.wlyy.service.third.guahao.IGuahaoService;
|
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
import com.yihu.wlyy.util.SystemConf;
|
|
|
import com.yihu.wlyy.web.WeixinBaseController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.json.JSONObject;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
@ -24,10 +28,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 预约挂号
|
|
@ -274,6 +275,18 @@ public class BookingController extends WeixinBaseController {
|
|
|
json.put("remark", msg);
|
|
|
PushMsgTask.getInstance().putWxMsg(getAccessToken(), 6, p.getOpenid(), p.getName(), json);
|
|
|
}
|
|
|
//发送短信小时
|
|
|
// 调用总部发送信息的接口
|
|
|
String result = HttpClientUtil.post(SystemConf.getInstance().getSmsUrl(), buildSmsParams(msg, p.getMobile()), "GBK");
|
|
|
JSONObject json = toJson(result);
|
|
|
// if (json == null) {
|
|
|
// // 发送失败
|
|
|
// throw new Exception("短信发送失败!");
|
|
|
// } else if (json.getInt("result") != 0) {
|
|
|
// return json.getString("description");
|
|
|
// } else {
|
|
|
// //发送成功,保存到数据库
|
|
|
// }
|
|
|
return write(200, "创建挂号单成功!");
|
|
|
}
|
|
|
else{
|
|
@ -285,6 +298,35 @@ public class BookingController extends WeixinBaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static List<NameValuePair> buildSmsParams(String content, String mobile) {
|
|
|
List<NameValuePair> params = new ArrayList<NameValuePair>();
|
|
|
params.add(new BasicNameValuePair("SpCode", SystemConf.getInstance().getSmsCode()));
|
|
|
params.add(new BasicNameValuePair("LoginName", SystemConf.getInstance().getSmsName()));
|
|
|
params.add(new BasicNameValuePair("Password", SystemConf.getInstance().getSmsPassword()));
|
|
|
params.add(new BasicNameValuePair("MessageContent", content));
|
|
|
params.add(new BasicNameValuePair("UserNumber", mobile));
|
|
|
params.add(new BasicNameValuePair("SerialNumber", String.valueOf(System.currentTimeMillis())));
|
|
|
params.add(new BasicNameValuePair("ScheduleTime", ""));
|
|
|
params.add(new BasicNameValuePair("f", "1"));
|
|
|
return params;
|
|
|
}
|
|
|
public static JSONObject toJson(String result) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
try {
|
|
|
String[] temps = result.split("&");
|
|
|
for (String temp : temps) {
|
|
|
if (temp.split("=").length != 2) {
|
|
|
continue;
|
|
|
}
|
|
|
String key = temp.split("=")[0];
|
|
|
String value = temp.split("=")[1];
|
|
|
json.put(key, value);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return json;
|
|
|
}
|
|
|
/**
|
|
|
* 创建挂号单
|
|
|
*/
|