Commit a2b1d1010cac5134574fd863767c4d3868feb34f

Authored by liquanyu
1 parent 50cb8af892

短信中心接口修改

Showing 3 changed files with 27 additions and 15 deletions

platform-data-api/src/main/java/com/lyms/platform/data/util/SaveMessageService.java View file @ a2b1d10
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import com.lyms.platform.common.utils.HttpRequest;
4 4 import com.lyms.platform.common.utils.JsonUtil;
  5 +import com.lyms.platform.common.utils.PropertiesUtils;
5 6 import com.lyms.platform.common.utils.StringUtils;
6 7 import com.lyms.platform.data.pojo.MessageListRequest;
7 8 import com.lyms.platform.data.pojo.MessageRequest;
8 9  
... ... @@ -15,12 +16,12 @@
15 16 */
16 17 public class SaveMessageService {
17 18  
18   - public static final String URL = "http://192.168.5.3:8080/v1/saveCreatedSMS";
19   -
  19 + public static final String CENTER_BASE_URL= PropertiesUtils.getPropertyValue("center_base_url");
  20 + public static final String CENTER_TOKEN = PropertiesUtils.getPropertyValue("center_token");
20 21 public static boolean saveSmsCenter(MessageListRequest list)
21 22 {
22 23 String json = JsonUtil.obj2JsonString(list);
23   - String result = HttpRequest.sendPost(URL,json,"YMer2016");
  24 + String result = HttpRequest.sendPost(CENTER_BASE_URL+"saveCreatedSMS",json,CENTER_TOKEN);
24 25 if (StringUtils.isNotEmpty(result))
25 26 {
26 27 Map<String,String> map = JsonUtil.str2Obj(result, Map.class);
... ... @@ -36,7 +37,7 @@
36 37 public static boolean isExistSms(String patientId,String tempId)
37 38 {
38 39 String param = "patientId="+patientId+"&tempId="+tempId;
39   - String result = HttpRequest.sendGet(URL, param, "YMer2016");
  40 + String result = HttpRequest.sendGet(CENTER_BASE_URL, param, CENTER_TOKEN);
40 41 if (StringUtils.isNotEmpty(result))
41 42 {
42 43 Map<String,String> map = JsonUtil.str2Obj(result, Map.class);
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/MessageCenterService.java View file @ a2b1d10
... ... @@ -3,6 +3,7 @@
3 3  
4 4 import com.lyms.platform.common.utils.HttpRequest;
5 5 import com.lyms.platform.common.utils.JsonUtil;
  6 +import com.lyms.platform.common.utils.PropertiesUtils;
6 7 import com.lyms.platform.common.utils.StringUtils;
7 8 import com.lyms.platform.operate.web.request.MessageListRequest;
8 9  
9 10  
10 11  
... ... @@ -13,13 +14,19 @@
13 14 * Created by Administrator on 2016/7/5.
14 15 */
15 16 public class MessageCenterService {
  17 + public static final String CENTER_BASE_URL= PropertiesUtils.getPropertyValue("center_base_url");
  18 + public static final String CENTER_TOKEN = PropertiesUtils.getPropertyValue("center_token");
16 19  
17   - public static final String URL = "http://192.168.5.3:8080/v1/saveCreatedSMS";
18   -
  20 + /**
  21 + * 服务配置修改 修改这个类短信不发送或者开启发送
  22 + * @param configs
  23 + * @param hid
  24 + * @return
  25 + */
19 26 public static boolean serviceConfig(List<Map<String,String>> configs,String hid)
20 27 {
21 28 String json = JsonUtil.obj2JsonString(configs);
22   - String result = HttpRequest.sendPost(URL, json, "YMer2016");
  29 + String result = HttpRequest.sendPost(CENTER_BASE_URL+"serviceConfig/{"+hid+"}", json, CENTER_TOKEN);
23 30 if (StringUtils.isNotEmpty(result))
24 31 {
25 32 Map<String,String> map = JsonUtil.str2Obj(result, Map.class);
26 33  
... ... @@ -32,10 +39,15 @@
32 39 }
33 40  
34 41  
  42 + /**
  43 + * 保存到短信中心 短信
  44 + * @param list
  45 + * @return
  46 + */
35 47 public static boolean saveSmsCenter(MessageListRequest list)
36 48 {
37 49 String json = JsonUtil.obj2JsonString(list);
38   - String result = HttpRequest.sendPost(URL,json,"YMer2016");
  50 + String result = HttpRequest.sendPost(CENTER_BASE_URL+"saveCreatedSMS", json, CENTER_TOKEN);
39 51 if (StringUtils.isNotEmpty(result))
40 52 {
41 53 Map<String,String> map = JsonUtil.str2Obj(result, Map.class);
... ... @@ -47,10 +59,5 @@
47 59 return false;
48 60 }
49 61  
50   -
51   - public static void main(String[] areg)
52   - {
53   -
54   - }
55 62 }
platform-operate-api/src/main/resources/config.properties View file @ a2b1d10
1   -url=test.url
  1 +#短信中心url
  2 +center_base_url=http://192.168.5.3:8080/v1/
  3 +
  4 +#区域平台访问短信中心的token
  5 +center_token=YMer2016