Browse Source

Merge branch 'dev' of chenyongxing/patient-co-management into dev

yeshijie 7 năm trước cách đây
mục cha
commit
72716b4e3e

+ 20 - 7
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java

@ -11,6 +11,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -33,6 +35,8 @@ public class CustomerService{
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	private String messageApi;
	private Logger logger = LoggerFactory.getLogger(CustomerService.class);
	public Map<String,Object> findServerInfo(Patient patient) throws Exception {
		Map<String, Object> resp = new HashMap<>();
@ -119,10 +123,14 @@ public class CustomerService{
			List<NameValuePair> par = new ArrayList<NameValuePair>();
			par.add(new BasicNameValuePair("openIds", openId));
			par.add(new BasicNameValuePair("content", msg));
			JSONObject params = new JSONObject();
			String result = HttpClientUtil.post(messageApi+"/sendWechatMessage", par,"UTF-8");
			JSONObject resultJson = new JSONObject(result);
			if(1!=resultJson.getInt("successNum")){
			try {
				String result = HttpClientUtil.post(messageApi+"/sendWechatMessage", par,"UTF-8");
				logger.info("微信发送消息返回结果:"+result);
				JSONObject resultJson = new JSONObject(result);
				if(1!=resultJson.getInt("successNum")){
					resp.put("wechat","-1");//-1代表发送失败
				}
			}catch (Exception e){
				resp.put("wechat","-1");//-1代表发送失败
			}
		}
@ -134,9 +142,14 @@ public class CustomerService{
			List<NameValuePair> par = new ArrayList<NameValuePair>();
			par.add(new BasicNameValuePair("mobiles", mobile));
			par.add(new BasicNameValuePair("content", msg));
			String result = HttpClientUtil.post(messageApi+"/sendMobileMessage",par,"UTF-8");
			JSONObject resultJson = new JSONObject(result);
			if(1!=resultJson.getInt("successNum")){
			try {
				String result = HttpClientUtil.post(messageApi+"/sendMobileMessage",par,"UTF-8");
				logger.info("发送短信消息返回结果:"+result);
				JSONObject resultJson = new JSONObject(result);
				if(1!=resultJson.getInt("successNum")){
					resp.put("mobile","-1");//-1代表发送失败
				}
			}catch (Exception e){
				resp.put("mobile","-1");//-1代表发送失败
			}
		}